summaryrefslogtreecommitdiff
path: root/repoze/bfg/zcml.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-11-19 10:44:55 +0000
committerChris McDonough <chrism@agendaless.com>2009-11-19 10:44:55 +0000
commiteac7c470021b647d63c2e2af8acd6cebd738f2a4 (patch)
tree6d04102c9442c0dd67a26d002ff89ae51b454993 /repoze/bfg/zcml.py
parent4dd55a50a7ed559748661f369313030773d13e75 (diff)
downloadpyramid-eac7c470021b647d63c2e2af8acd6cebd738f2a4.tar.gz
pyramid-eac7c470021b647d63c2e2af8acd6cebd738f2a4.tar.bz2
pyramid-eac7c470021b647d63c2e2af8acd6cebd738f2a4.zip
Rearrange things to try to avoid circular import deps.
Diffstat (limited to 'repoze/bfg/zcml.py')
-rw-r--r--repoze/bfg/zcml.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py
index a7c5f2660..eae53c337 100644
--- a/repoze/bfg/zcml.py
+++ b/repoze/bfg/zcml.py
@@ -1,5 +1,7 @@
from zope.configuration.exceptions import ConfigurationError
from zope.configuration.fields import GlobalObject
+from zope.configuration.config import ConfigurationMachine
+from zope.configuration import xmlconfig
from zope.interface import Interface
@@ -22,7 +24,6 @@ from repoze.bfg.authentication import RepozeWho1AuthenticationPolicy
from repoze.bfg.authentication import RemoteUserAuthenticationPolicy
from repoze.bfg.authentication import AuthTktAuthenticationPolicy
from repoze.bfg.authorization import ACLAuthorizationPolicy
-from repoze.bfg.configuration import zcml_configure
from repoze.bfg.configuration import Configurator
from repoze.bfg.path import package_name
from repoze.bfg.request import route_request_iface
@@ -536,5 +537,19 @@ class Uncacheable(object):
""" Include in discriminators of actions which are not cacheable;
this class only exists for backwards compatibility (<0.8.1)"""
+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
+ ZCML into the current ZCML registry.
+
+ .. note:: This feature is new as of :mod:`repoze.bfg` 1.1.
+ """
+ context = ConfigurationMachine()
+ xmlconfig.registerCommonDirectives(context)
+ context.package = package
+ xmlconfig.include(context, name, package)
+ context.execute_actions(clear=False) # the raison d'etre
+ return context.actions
+
file_configure = zcml_configure # backwards compat (>0.8.1)