Coverage for /home/tribaal/workspace/django-shop/shop/backends_pool : 100.00%

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 -*-
""" A pool for backends. It handles loading backend modules (both shipping and payment backends), and keeping a cached copy of the classes in-memory (so that the backends aren't loaded from file every time one requests them) """
""" The use_cache parameter is mostly used for testing, since setting it to false will trigger reloading from disk """
""" Returns the list of payment backends, as instances, from the list of backends defined in settings.SHOP_PAYMENT_BACKENDS """ else: self.PAYMENT, self.PAYMENT_SHOP_INTERFACE)
""" Returns the list of shipping backends, as instances, from the list of backends defined in settings.SHOP_SHIPPING_BACKENDS """ else: self.SHIPPING, self.SHIPPING_SHOP_INTERFACE)
""" This enforces having a valid name and url namespace defined. Backends, both shipping and payment are namespaced in respectively /pay/ and /ship/ URL spaces, so as to avoid name clashes.
"Namespaces are one honking great idea -- let's do more of those!" """ 'One of your backends ("%s" of type "%s") lacks a name, please' ' define one.' % d_tuple)
'Please set a namespace for backend "%s"' % backend_instance.backend_name)
""" This actually loads the backends from disk"""
# The load_class function takes care of the classloading. It # returns a CLASS, not an INSTANCE!
# Seems like it is a real, valid class - let's instanciate it! # This is where the backends receive their self.shop reference!
# The backend seems valid (nothing raised), let's add it to the # return list.
|