diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-11-16 18:58:34 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-11-16 18:58:34 +0000 |
| commit | 58fdd1e948b7223cbcaf4fdceb159de200356d79 (patch) | |
| tree | 162985896bd8ff3e88069029caf55ed5b5e0ec1b /repoze/bfg/configuration.py | |
| parent | 131f5f3046eb71145ebeb2a05b90bd89ec829dd9 (diff) | |
| download | pyramid-58fdd1e948b7223cbcaf4fdceb159de200356d79.tar.gz pyramid-58fdd1e948b7223cbcaf4fdceb159de200356d79.tar.bz2 pyramid-58fdd1e948b7223cbcaf4fdceb159de200356d79.zip | |
Merge imperativeconfig branch.
Diffstat (limited to 'repoze/bfg/configuration.py')
| -rw-r--r-- | repoze/bfg/configuration.py | 18 |
1 files changed, 5 insertions, 13 deletions
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 <route/> 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 |
