Skip to content

Commit

Permalink
Remove need to have product in context
Browse files Browse the repository at this point in the history
This fix checks to see if the product is in the context before trying to access its id property. The current logic is that it accesses its id property so that it can remove the current product that is being viewed from the recently viewed product list. If there is no product in the context this check doesn't happen anymore.
  • Loading branch information
Mohammad Abbas committed May 7, 2013
1 parent ff04559 commit acde537
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion oscar/templatetags/history_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def recently_viewed_products(context):
product_ids = get_recently_viewed_product_ids(request)

current_product = context.get('product', None)
if current_product.id in product_ids:
if current_product and current_product.id in product_ids:
product_ids.remove(current_product.id)

# Reordering as the id order gets messed up in the query
Expand Down

0 comments on commit acde537

Please sign in to comment.