Commits

Cristian Ciupitu  committed db159d2

product.views.get_product: make the code a bit more Pythonic

  • Participants
  • Parent commits 9aff298

Comments (0)

Files changed (1)

File satchmo/apps/product/views/__init__.py

     default_view_tax=None):
     """Basic product view"""
 
-    errors = list(m for m in get_messages(request) if m.level == constants.ERROR)
+    errors = [m for m in get_messages(request) if m.level == constants.ERROR]
 
     try:
         product = Product.objects.get_by_site(active=True, slug=product_slug)
         'current_product' : current_product,
         'default_view_tax': default_view_tax,
         'sale': best_discount,
-        'error_message' : errors[0] if len(errors) else None,
+        'error_message' : errors[0] if errors else None,
     }
 
     # Get the template context from the Product.