Beispiel #1
0
 def _get_view(self, view):
     try:
         module = import_y(''.join(view.split('.')[:-1]))
         view_func = getattr(module, view.split('.')[-1])
     except (ImportError, AttributeError):
         raise ImproperlyConfigured('View function {0} does not exist'.format(view))
     return view_func
Beispiel #2
0
 def __init__(self, routepatterns):
     if isinstance(routepatterns, basestring):
         try:
             routeconf = import_y(routepatterns)
         except ImportError:
             raise ImproperlyConfigured('Routeconf {0} could not be imported'.format(routepatterns))
         try:
             self.patterns = getattr(routeconf, 'routepatterns')
         except AttributeError:
             raise ImproperlyConfigured('Routeconf {0} has no routepatterns attribute'.format(routepatterns))
     else:
         self.patterns = routepatterns