diefenbach / django-lfs

An online-shop based on Django
http://www.getlfs.com
BSD 3-Clause "New" or "Revised" License
622 stars 222 forks source link

Portlets templatetag throws AttributeError #26

Closed davidthornhill closed 10 years ago

davidthornhill commented 12 years ago

Line 37 of lfs/portlet/templatetags/lfs_portlets_tags.py will throw an AttributeError if another app passes a 'category', 'product' or 'page' to context that does not have an 'id' attribute.

In our case, django-photologue is passing an int object as 'page' via the url /photos/gallery/page/1/.

We have applied a workaround to test for the id attribute...

    if instance is None or not hasattr(instance, 'id'):
        instance = lfs.core.utils.get_default_shop(request)