From 58fdd1e948b7223cbcaf4fdceb159de200356d79 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 16 Nov 2009 18:58:34 +0000 Subject: Merge imperativeconfig branch. --- repoze/bfg/configuration.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'repoze/bfg/configuration.py') diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index 077b72438..2b74017dc 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -21,6 +21,7 @@ from repoze.bfg.interfaces import ISettings from repoze.bfg.authorization import ACLAuthorizationPolicy from repoze.bfg.log import make_stream_logger from repoze.bfg.registry import Registry +from repoze.bfg.registry import DefaultRootFactory from repoze.bfg.settings import Settings from repoze.bfg.settings import get_options from repoze.bfg.threadlocal import get_current_registry @@ -62,11 +63,10 @@ def make_registry(root_factory, package=None, filename='configure.zcml', if root_factory is None: root_factory = DefaultRootFactory - # register the *default* root factory so apps can find it later - registry.registerUtility(root_factory, IDefaultRootFactory) - mapper = RoutesRootFactory(root_factory) registry.registerUtility(mapper, IRoutesMapper) + # register the *default* root factory so apps can find it later + registry.registerUtility(root_factory, IDefaultRootFactory) if authentication_policy: debug_logger.warn( @@ -113,6 +113,8 @@ def make_registry(root_factory, package=None, filename='configure.zcml', lock.release() manager.pop() + mapper = registry.getUtility(IRoutesMapper) + if mapper.has_routes(): # if the user had any statements in his configuration, # use the RoutesRootFactory as the IRootFactory; otherwise use the @@ -124,16 +126,6 @@ def make_registry(root_factory, package=None, filename='configure.zcml', return registry -class DefaultRootFactory: - __parent__ = None - __name__ = None - def __init__(self, request): - matchdict = getattr(request, 'matchdict', {}) - # provide backwards compatibility for applications which - # used routes (at least apps without any custom "context - # factory") in BFG 0.9.X and before - self.__dict__.update(matchdict) - def zcml_configure(name, package): """ Given a ZCML filename as ``name`` and a Python package as ``package`` which the filename should be relative to, load the -- cgit v1.2.3