Coverage for /home/tribaal/workspace/django-shop/shop/util/address : 86.21%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#-*- coding: utf-8 -*-
#============================================================================== # Addresses handling #==============================================================================
""" Get the shipping address from the request. This abstracts the fact that users can be either registered (and thus, logged in), or only session-based guests """ # There is a logged-in user here, but he might not have an address # defined. user_shipping=request.user) else: # The client is a guest - let's use the session instead.
""" Get the billing address from the request. This abstracts the fact that users can be either registered (and thus, logged in), or only session-based guests """ # There is a logged-in user here, but he might not have an address # defined. user_billing=request.user) else: # The client is a guest - let's use the session instead.
""" Sets the passed address as either the shipping or the billing address for the passed request. This abstracts the difference between logged-in users and session-based guests.
The `shipping` parameter controls whether the address is a shipping address (default) or a billing address. """ # There is a logged-in user here. else: else: # The client is a guest - let's use the session instead. There has to # be a session. Otherwise it's fine to get an AttributeError else:
""" Simple helper to return the username from the request, or '' if the user is AnonymousUser. """ name = '' if request.user and not isinstance(request.user, AnonymousUser): name = request.user.get_full_name() # TODO: Administrators! return name |