def include(prefix, routes): if isinstance(routes, StringTypes): routes = import_class('%s.routes' % routes) elif hasattr(routes, 'routes'): routes = routes.routes routes = [ Router.route_class(*route) if isinstance(route, tuple) else route for route in routes ] return PathPrefixRoute(prefix, routes)
def test_import_class_from_instance(self): """ import_class - importing class type from usage """ timedelta_class = import_class('datetime.timedelta') from datetime import timedelta self.assertEqual(type(timedelta()), timedelta_class) self.assertEqual(type(timedelta()), import_class(timedelta))
def post(self, queue_name, callback): request = self.request callback = import_class(callback) callback(*json.loads(request.get('args')), **json.loads(request.get('kwargs')))
def _get_filters(self): import config return [ import_class(f) for f in getattr(config, 'REQUEST_FILTERS', []) ] # copy
def _get_filters(self): import config return [import_class(f) for f in getattr(config, 'REQUEST_FILTERS', [])] # copy