コード例 #1
0
ファイル: routeresolvers.py プロジェクト: bluepeppers/l33ty
 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
コード例 #2
0
ファイル: routeresolvers.py プロジェクト: bluepeppers/l33ty
 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