Kai Diefenbach committed 969010b

Added optional cached parameter to cart/utils/get_cart_price and cart/utils/get_cart_costs

Comments (0)

Files changed (1)


     return max_delivery_time
 # TODO: Remove cart from signature?
-def get_cart_price(request, cart, total=False):
+def get_cart_price(request, cart, total=False, cached=True):
     """Returns price of the given cart.
-    return get_cart_costs(request, cart, total)["price"]
+    return get_cart_costs(request, cart, total, cached)["price"]
-def get_cart_costs(request, cart, total=False):
+def get_cart_costs(request, cart, total=False, cached=True):
     """Returns a dictionary with price and tax of the given cart:
         returns {
         return {"price" : 0, "tax" : 0}
     cache_key = "cart-costs-%s-%s" % (total,
-    cart_costs = cache.get(cache_key)
+    if cached:
+        cart_costs = cache.get(cache_key)
+    else:
+        cart_costs = None
     if cart_costs is None: