diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-05-24 02:57:13 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-05-24 02:57:13 +0000 |
| commit | ab5959d3d4e4603a61b3559096da30d2adfdcf4b (patch) | |
| tree | 8a14ba839615678ab1eb4510782595af2d51f4d5 | |
| parent | 91836947c4956fce2ed83c7819424c03b505ae1f (diff) | |
| download | pyramid-ab5959d3d4e4603a61b3559096da30d2adfdcf4b.tar.gz pyramid-ab5959d3d4e4603a61b3559096da30d2adfdcf4b.tar.bz2 pyramid-ab5959d3d4e4603a61b3559096da30d2adfdcf4b.zip | |
Simplify constructor.
| -rw-r--r-- | repoze/bfg/router.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index 614d32aa2..81bc6e4ef 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -44,28 +44,24 @@ _marker = object() class Router(object): """ The main repoze.bfg WSGI application. """ implements(IRouter) - + + debug_authorization = False + debug_notfound = False + def __init__(self, registry): self.registry = registry self.request_factory = registry.queryUtility(IRequestFactory) self.security_policy = registry.queryUtility(ISecurityPolicy) - - notfound_app_factory = registry.queryUtility(INotFoundAppFactory) - if notfound_app_factory is None: - notfound_app_factory = NotFound - self.notfound_app_factory = notfound_app_factory - - unauth_app_factory = registry.queryUtility(IUnauthorizedAppFactory) - if unauth_app_factory is None: - unauth_app_factory = Unauthorized - self.unauth_app_factory = unauth_app_factory + self.notfound_app_factory = registry.queryUtility( + INotFoundAppFactory, + default=NotFound) + self.unauth_app_factory = registry.queryUtility( + IUnauthorizedAppFactory, + default=Unauthorized) settings = registry.queryUtility(ISettings) - if settings is None: - self.debug_authorization = False - self.debug_notfound = False - else: + if settings is not None: self.debug_authorization = settings.debug_authorization self.debug_notfound = settings.debug_notfound |
