diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-12 22:39:52 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-12 22:39:52 +0000 |
| commit | 1115939b6d4e0367386e20100a53c97c811577ad (patch) | |
| tree | 5c18b671abdafc60261d8c000bf3578daf3bb43d /repoze/bfg/router.py | |
| parent | 09415724ee0078416199f0045920f83ab798004d (diff) | |
| download | pyramid-1115939b6d4e0367386e20100a53c97c811577ad.tar.gz pyramid-1115939b6d4e0367386e20100a53c97c811577ad.tar.bz2 pyramid-1115939b6d4e0367386e20100a53c97c811577ad.zip | |
Speculative: cause routers to accept an app_context (the zcml configuration context), so we can later enable an app-local component registry.
Diffstat (limited to 'repoze/bfg/router.py')
| -rw-r--r-- | repoze/bfg/router.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index c617efebf..599007833 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -13,8 +13,9 @@ from repoze.bfg.interfaces import IRequest _marker = () class Router: - def __init__(self, root_policy): + def __init__(self, root_policy, app_context): self.root_policy = root_policy + self.app_context = app_context def __call__(self, environ, start_response): request = Request(environ) @@ -34,9 +35,18 @@ class Router: IWSGIApplicationFactory) return app(environ, start_response) +# enable the below when we figure out app-local registries + +## def app_component_registry(app_context): +## registry = getattr(app_context, 'registry', None) +## if registry is None: +## from zope.component.registry import Components +## app_context.registry = Components() +## return app_context.registry + def make_app(root_policy, package=None, filename='configure.zcml'): import zope.configuration.xmlconfig - zope.configuration.xmlconfig.file(filename, package=package) - return Router(root_policy) + context = zope.configuration.xmlconfig.file(filename, package=package) + return Router(root_policy, context) |
