1. Michelle Mark
  2. session-cart


topaz1968  committed 314ce45 Draft

in cart.py fixed syntax error on line 10, typo of settings on line 32 and replaced dot with comma in parameter list on line 62

  • Participants
  • Parent commits 8e264fa
  • Branches default

Comments (0)

Files changed (1)

File session_cart/cart.py

View file
 class CartItem(object):
     '''Lightweight container for cart items'''
     __slots__ = ('item', 'quantity',)
-    def __init__(self, item, quantity=None):
+    def __init__(self, item, quantity=0):
         self.item = item
-        self.quantity = quantity if quantity or 0
+        self.quantity = quantity
     def __repr__(self):
         return 'CartItem(%r, %r)' % (self.item, self.quantity)
             from django.db import models
             from django.conf import settings
-                Cart.model = import_cart(settiongs.CART_MODEL)
+                Cart.model = import_cart(settings.CART_MODEL)
             except AttributeError:
                 raise ImproperlyConfigured("%s isn't a valid Cart model." % settings.CART_MODEL)
         # Cart is stored as a list of ( item_id, quantity )
         except ValueError:
             super(Cart, self).append(CartItem(item, quantity))
-    def index(self. value, **kwargs):
+    def index(self, value, **kwargs):
         '''Prevent duplication of (item, quantity) pairs.'''
         if isinstance(value, self.model):
             value = CartItem(value)