Commits

Chris Moffitt committed 9bcaeae

Slight code optimization for product ratings. Closes #1423

  • Participants
  • Parent commits 1814a0f

Comments (0)

Files changed (1)

satchmo/apps/satchmo_ext/productratings/queries.py

         cache_set(nce.key, value=pkstring)
     
     if pks:
-        pks = [pk for pk in pks if _int_or_long(pk)]
+        pks = [pk for pk in pks if isinstance(pk, (int, long))]
         productdict = Product.objects.in_bulk(pks)
         products = []
         for pk in pks:
         products = []
         
     return products
-        
-        
-def _int_or_long(v):
-    try:
-        v = int(v)
-    except ValueError:
-        try:
-            v = long(v)
-        except ValueError:
-            return False
-    return True