summaryrefslogtreecommitdiff
path: root/repoze/bfg/configuration.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-08-13 03:55:49 +0000
committerChris McDonough <chrism@agendaless.com>2010-08-13 03:55:49 +0000
commitec55db55aba80618fb250aace0d22f0aa56cef1f (patch)
tree84f98cfbfb0c46df4261fb670d8afa2f2fd2df3d /repoze/bfg/configuration.py
parent59ee5fc5d9c27b46fc4514626aa87a221df78630 (diff)
downloadpyramid-ec55db55aba80618fb250aace0d22f0aa56cef1f.tar.gz
pyramid-ec55db55aba80618fb250aace0d22f0aa56cef1f.tar.bz2
pyramid-ec55db55aba80618fb250aace0d22f0aa56cef1f.zip
- The new
:meth"`repoze.bfg.configuration.Configurator.absolute_resource_spec` method resolves a potentially relative :term:`resource specification` string into an absolute version.
Diffstat (limited to 'repoze/bfg/configuration.py')
-rw-r--r--repoze/bfg/configuration.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py
index 59ae63989..89d287f14 100644
--- a/repoze/bfg/configuration.py
+++ b/repoze/bfg/configuration.py
@@ -325,6 +325,19 @@ class Configurator(object):
constructor."""
return self.name_resolver.maybe_resolve(dotted)
+ def absolute_resource_spec(self, relative_spec):
+ """ Resolve the potentially relative :term:`resource
+ specification` string passed as ``relative_spec`` into an
+ absolute resource specification string and return the string.
+ Use the ``package`` of this configurator as the package to
+ which the resource specification will be considered relative
+ when generating an absolute resource specification. If the
+ provided ``relative_spec`` argument is already absolute, or if
+ the ``relative_spec`` is not a string, it is simply returned."""
+ if not isinstance(relative_spec, basestring):
+ return relative_spec
+ return self._make_spec(relative_spec)
+
def setup_registry(self, settings=None, root_factory=None,
authentication_policy=None, authorization_policy=None,
renderers=DEFAULT_RENDERERS, debug_logger=None,