Coverage for /home/tribaal/workspace/django-shop/shop/util/loader : 68.66%

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 -*-
'be in ther form of a tuple: (\'path.to.models.Class\', \'app_label\').'''
""" Loads a class given a class_path. The setting value may be a string or a tuple. The setting_name parameter is only there for pretty error output, and therefore is optional """ else: try: class_path, app_label = class_path except: if setting_name: raise exceptions.ImproperlyConfigured(CLASS_PATH_ERROR % (setting_name, setting_name)) else: raise exceptions.ImproperlyConfigured(CLASS_PATH_ERROR % ("this setting", "It"))
class_path, setting_name) else:
class_module, e, setting_name) else:
' your %s setting' % (class_module, class_name, setting_name)) else: class_module, class_name)
""" Returns the model string notation Django uses for lazily loaded ForeignKeys (eg 'auth.User') to prevent circular imports.
This is needed to allow our crazy custom model usage. """
elif isinstance(class_path, basestring): parts = class_path.split('.') try: index = parts.index('models') - 1 except ValueError, e: raise exceptions.ImproperlyConfigured(CLASS_PATH_ERROR % (setting_name, setting_name)) app_label, model_name = parts[index], parts[-1] else: try: class_path, app_label = class_path model_name = class_path.split('.')[-1] except: raise exceptions.ImproperlyConfigured(CLASS_PATH_ERROR % (setting_name, setting_name))
return "%s.%s" % (app_label, model_name)
|