def UserClass(): global _user_implementations mod = sites.settings.USER_MODEL if mod: impl = _user_implementations.get(mod, AnonymousUser) if isinstance(impl, str): impl = module_attribute(impl) _user_implementations[mod] = impl return impl else: return AnonymousUser
def setup_environment(self): '''Set up the the site.''' for app in self.settings.INSTALLED_APPS: try: mod = import_module(app+'.request') for name in dir(mod): processor = getattr(mod, name) if getattr(processor, 'request_processor', False): self.request_processors.append(processor) except ImportError: pass # No management module if self.root == self: for wrapper in orms.model_wrappers.values(): wrapper.setup_environment(self) add_default_handlers(self) appurls = self.APPLICATION_URLS if appurls: if not hasattr(appurls, '__call__'): if isinstance(appurls, str): appurls = module_attribute(appurls,safe=False) if hasattr(appurls,'__call__'): appurls = appurls(self) self.routes.extend(copy(appurls)) return len(self)
def setup_environment(self): '''Set up the the site.''' for app in self.settings.INSTALLED_APPS: try: mod = import_module(app + '.request') for name in dir(mod): processor = getattr(mod, name) if getattr(processor, 'request_processor', False): self.request_processors.append(processor) except ImportError: pass # No management module if self.root == self: for wrapper in orms.model_wrappers.values(): wrapper.setup_environment(self) add_default_handlers(self) appurls = self.APPLICATION_URLS if appurls: if not hasattr(appurls, '__call__'): if isinstance(appurls, str): appurls = module_attribute(appurls, safe=False) if hasattr(appurls, '__call__'): appurls = appurls(self) self.routes.extend(copy(appurls)) return len(self)