From 1115939b6d4e0367386e20100a53c97c811577ad Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 12 Jul 2008 22:39:52 +0000 Subject: Speculative: cause routers to accept an app_context (the zcml configuration context), so we can later enable an app-local component registry. --- repoze/bfg/router.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'repoze/bfg/router.py') 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) -- cgit v1.2.3