from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

from .handler import AddToCartHandler

add_to_cart_handler = AddToCartHandler('cart')

if not getattr(settings, 'SATCHLESS_DEFAULT_CURRENCY', None):
    raise ImproperlyConfigured('You need to configure '
                               'SATCHLESS_DEFAULT_CURRENCY')
class InvalidQuantityException(Exception):

    def __init__(self, reason, quantity_delta):
        self.reason = reason
        self.quantity_delta = quantity_delta

    def __str__(self):
        return self.reason


Add cart quantity exception, remove old handler
Add cart quantity exception, remove old handler

+ class InvalidQuantityException(Exception):
- from django.conf import settings
- from django.core.exceptions import ImproperlyConfigured
  
- from .handler import AddToCartHandler
+     def __init__(self, reason, quantity_delta):
+         self.reason = reason
+         self.quantity_delta = quantity_delta
  
- add_to_cart_handler = AddToCartHandler('cart')
+     def __str__(self):
+         return self.reason
  
+ 
- if not getattr(settings, 'SATCHLESS_DEFAULT_CURRENCY', None):
-     raise ImproperlyConfigured('You need to configure '
-                                'SATCHLESS_DEFAULT_CURRENCY')
Add cart quantity exception, remove old handler
## Code Before:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

from .handler import AddToCartHandler

add_to_cart_handler = AddToCartHandler('cart')

if not getattr(settings, 'SATCHLESS_DEFAULT_CURRENCY', None):
    raise ImproperlyConfigured('You need to configure '
                               'SATCHLESS_DEFAULT_CURRENCY')
## Instruction:
Add cart quantity exception, remove old handler
## Code After:
class InvalidQuantityException(Exception):

    def __init__(self, reason, quantity_delta):
        self.reason = reason
        self.quantity_delta = quantity_delta

    def __str__(self):
        return self.reason

