Skip to content

Commit

Permalink
refactor: cart does not depend on request anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobi-De committed Jun 1, 2024
1 parent 0c5be05 commit 671420d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions dj_shop_cart/cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 671420d

Please sign in to comment.