From 671420d7263fe5756835049908dcf4e9d731154b Mon Sep 17 00:00:00 2001 From: Tobi DEGNON Date: Sat, 1 Jun 2024 11:41:10 +0100 Subject: [PATCH] refactor: cart does not depend on request anymore --- dj_shop_cart/cart.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dj_shop_cart/cart.py b/dj_shop_cart/cart.py index 7ba92aa..f71e1c9 100644 --- a/dj_shop_cart/cart.py +++ b/dj_shop_cart/cart.py @@ -63,7 +63,6 @@ def from_product( @define(kw_only=True) class Cart: - request: HttpRequest storage: Storage prefix: str = field(default=DEFAULT_CART_PREFIX) _metadata: dict = field(factory=dict) @@ -279,7 +278,7 @@ def clear_metadata(self, *keys: list[str]) -> None: def new(cls, request: HttpRequest, prefix: str = DEFAULT_CART_PREFIX) -> Cart: """Appropriately create a new cart instance. This builder load existing cart if needed.""" storage = get_module(conf.CART_STORAGE_BACKEND)(request) - instance = cls(request=request, storage=storage, prefix=prefix) + instance = cls(storage=storage, prefix=prefix) try: data = storage.load().get(prefix, {}) except AttributeError: