registrasion/controllers/cart.py
def for_user(cls, user):
        ''' Returns the user's current cart, or creates a new cart
        if there isn't one ready yet. '''

        try:
            existing = commerce.Cart.objects.get(
                user=user,
                status=commerce.Cart.STATUS_ACTIVE,
            )
        except ObjectDoesNotExist:
            existing = commerce.Cart.objects.create(
                user=user,
                time_last_updated=timezone.now(),
                reservation_duration=datetime.timedelta(),
            )
        return cls(existing)
def for_user(cls, user):
        ''' Returns the user's current cart, or creates a new cart
        if there isn't one ready yet. '''

        try:
            existing = commerce.Cart.objects.get(
                user=user,
                status=commerce.Cart.STATUS_ACTIVE,
            )
        except ObjectDoesNotExist:
            existing = commerce.Cart.objects.create(
                user=user,
                time_last_updated=timezone.now(),
                reservation_duration=datetime.timedelta(),
            )
        return cls(existing)
def for_user ( cls , user ) : try : existing = commerce . Cart . objects . get ( user = user , status = commerce . Cart . STATUS_ACTIVE , ) except ObjectDoesNotExist : existing = commerce . Cart . objects . create ( user = user , time_last_updated = timezone . now ( ) , reservation_duration = datetime . timedelta ( ) , ) return cls ( existing )
Returns the user's current cart, or creates a new cart
        if there isn't one ready yet.
Returns the user s current cart or creates a new cart if there isn t one ready yet .