Commits

Chris Moffitt committed 3bed3f2 Merge
  • Participants
  • Parent commits 8ffc5b7, 56a45d8

Comments (0)

Files changed (1)

File satchmo/apps/satchmo_ext/tieredpricing/models.py

     dynamic_price = property(fget=_dynamic_price)
 
     def save(self, **kwargs):
-        """Save with the prevention of storing duplicates""" 
+        """Save with the prevention of storing duplicates"""
         prices = TieredPrice.objects.filter(product=self.product, quantity=self.quantity, pricingtier=self.pricingtier)
         if self.expires:
             prices = prices.filter(expires=self.expires)
             # After required Django version will be 1.3+, the previous line can be replaced by:
             #modified_users = kwargs['pk_set']
         for user_id in modified_users_id:
-            key = 'TIER_%i' % user_id
-            threadlocals.set_thread_variable(key, None)
+            if user_id:
+                key = 'TIER_%i' % user_id
+                threadlocals.set_thread_variable(key, None)
 
 models.signals.m2m_changed.connect(pricingtier_group_change_listener, sender=User.groups.through)