diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-07-02 17:20:31 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-07-02 17:20:31 +0000 |
| commit | b5104e12d5f4e8618b6bc21bf7a0da2bce62d8cb (patch) | |
| tree | ed2df319cfb894bf2ea501b5efa42a5412956af1 /repoze/bfg/router.py | |
| parent | 5e19ddda73d5792fe27a6710319c16860373c589 (diff) | |
| download | pyramid-b5104e12d5f4e8618b6bc21bf7a0da2bce62d8cb.tar.gz pyramid-b5104e12d5f4e8618b6bc21bf7a0da2bce62d8cb.tar.bz2 pyramid-b5104e12d5f4e8618b6bc21bf7a0da2bce62d8cb.zip | |
Allow ``zcml_configure`` value to override the package.
Diffstat (limited to 'repoze/bfg/router.py')
| -rw-r--r-- | repoze/bfg/router.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index 3b9b12cb7..5addef933 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -225,17 +225,21 @@ def make_app(root_factory, package=None, filename='configure.zcml', ``package`` is a Python module representing the application's package. It is optional, defaulting to ``None``. ``package`` may - be ``None``. If ``package`` is ``None``, either the ``filename`` - passed or the value in the ``options`` dictionary named - ``configure_zcml`` must be an absolute pathname to a ZCML file - that represents the application's configuration. + be ``None``. If ``package`` is ``None``, the ``filename`` passed + or the value in the ``options`` dictionary named + ``configure_zcml`` must be a) absolute pathname to a ZCML file + that represents the application's configuration *or* b) a + 'specification' in the form + ``dotted_package_name:relative/file/path.zcml``. ``filename`` is the filesystem path to a ZCML file (optionally relative to the package path) that should be parsed to create the - application registry. It defaults to ``configure.zcml``. Note - that if any value for ``configure_zcml`` is passed within the - ``options`` dictionary, the value passed as ``filename`` will be - ignored, replaced with the ``configure_zcml`` value. + application registry. It defaults to ``configure.zcml``. It can + also be a 'specification' in the form + ``dotted_package_name:relatve/file/path.zcml``. Note that if any + value for ``configure_zcml`` is passed within the ``options`` + dictionary, the value passed as ``filename`` will be ignored, + replaced with the ``configure_zcml`` value. ``authentication_policy`` should be an object that implements the ``repoze.bfg.interfaces.IAuthenticationPolicy`` interface (e.g. @@ -277,6 +281,11 @@ def make_app(root_factory, package=None, filename='configure.zcml', settings = Settings(get_options(options)) filename = settings['configure_zcml'] + if ':' in filename: + package, filename = filename.split(':', 1) + __import__(package) + package = sys.modules[package] + if registry is None: regname = filename if package: |
