diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-05-27 23:49:11 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-05-27 23:49:11 +0000 |
| commit | ca555cb4c86810af35149c702eb945c5b9400df9 (patch) | |
| tree | 6fbc985513e45cfe54e63c105f912a10345597fd | |
| parent | f4108da64a4f24d5710c7e03389a9316cf62d342 (diff) | |
| download | pyramid-ca555cb4c86810af35149c702eb945c5b9400df9.tar.gz pyramid-ca555cb4c86810af35149c702eb945c5b9400df9.tar.bz2 pyramid-ca555cb4c86810af35149c702eb945c5b9400df9.zip | |
- Allow IAuthenticationPolicy and IAuthorizationPolicy to be
overridden via ZCML registrations (do ZCML parsing after
registering these in router.py).
| -rw-r--r-- | CHANGES.txt | 7 | ||||
| -rw-r--r-- | repoze/bfg/router.py | 25 |
2 files changed, 20 insertions, 12 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 0a476b3f0..9610e3713 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,13 @@ 0.9dev (unreleased) =================== +Features +-------- + +- Allow IAuthenticationPolicy and IAuthorizationPolicy to be + overridden via ZCML registrations (do ZCML parsing after + registering these in router.py). + Documentation ------------- diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index 1b535c442..92fc5b58a 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -325,18 +325,6 @@ def make_app(root_factory, package=None, filename='configure.zcml', registry.registerUtility(settings, ISettings) mapper = RoutesRootFactory(root_factory) registry.registerUtility(mapper, IRoutesMapper) - populateRegistry(registry, filename, package) - if mapper.has_routes(): - # if the user had any <route/> statements in his configuration, - # use the RoutesRootFactory as the root factory - root_factory = mapper - else: - # otherwise, use only the supplied root_factory (unless it's None) - if root_factory is None: - raise ValueError( - 'root_factory (aka get_root) was None and no routes connected') - - registry.registerUtility(root_factory, IRootFactory) if authentication_policy: registry.registerUtility(authentication_policy, IAuthenticationPolicy) @@ -358,6 +346,19 @@ def make_app(root_factory, package=None, filename='configure.zcml', 'release.') registerBBBAuthn(secpol, registry) + populateRegistry(registry, filename, package) + if mapper.has_routes(): + # if the user had any <route/> statements in his configuration, + # use the RoutesRootFactory as the root factory + root_factory = mapper + else: + # otherwise, use only the supplied root_factory (unless it's None) + if root_factory is None: + raise ValueError( + 'root_factory (aka get_root) was None and no routes connected') + + registry.registerUtility(root_factory, IRootFactory) + app = Router(registry) # We push the registry on to the stack here in case any ZCA API is |
