def get_or_create_cart_from_request(request, cart_queryset=Cart.objects.all()):
 if request.user.is_authenticated():
  return get_or_create_user_cart(request.user, cart_queryset)
 else:
  token = request.get_signed_cookie(Cart.COOKIE_NAME, default=None)
  return get_or_create_anonymous_cart_from_token(token, cart_queryset)

def get_or_create_cart_from_request ( request , cart_queryset = Cart . objects . all ( ) ) : if request . user . is_authenticated ( ) : return get_or_create_user_cart ( request . user , cart_queryset ) else : token = request . get_signed_cookie ( Cart . COOKIE_NAME , default = None ) return get_or_create_anonymous_cart_from_token ( token , cart_queryset )
get cart from database or create new cart if not found :type cart_queryset: saleor .