diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-02-04 18:32:36 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-02-04 18:32:36 +0000 |
| commit | 89968dce0273f49cf34e07480077f7843593f54e (patch) | |
| tree | bc7f1f02d0af23c497bbb612e962def3a044d6fc /repoze/bfg/zcml.py | |
| parent | d43b02fbe101233ad89eee605d558ca6f60a7e01 (diff) | |
| download | pyramid-89968dce0273f49cf34e07480077f7843593f54e.tar.gz pyramid-89968dce0273f49cf34e07480077f7843593f54e.tar.bz2 pyramid-89968dce0273f49cf34e07480077f7843593f54e.zip | |
- Fix a bug whereby a ``renderer`` argument to the ``@bfg_view``
decorator that provided a package-relative template filename might
not have been resolved properly. Symptom: inappropriate ``Missing
template resource`` errors.
Diffstat (limited to 'repoze/bfg/zcml.py')
| -rw-r--r-- | repoze/bfg/zcml.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index fabc1a03c..4ae04387f 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -30,8 +30,8 @@ from repoze.bfg.authentication import RepozeWho1AuthenticationPolicy from repoze.bfg.authorization import ACLAuthorizationPolicy from repoze.bfg.configuration import Configurator from repoze.bfg.exceptions import ConfigurationError -from repoze.bfg.path import package_path from repoze.bfg.request import route_request_iface +from repoze.bfg.resource import resource_spec_from_abspath from repoze.bfg.static import StaticRootFactory from repoze.bfg.threadlocal import get_current_registry @@ -775,24 +775,14 @@ def utility(_context, provides=None, component=None, factory=None, name=''): ) def path_spec(context, path): - # Convert an absolute path to a resource in a package to a - # resource specification if possible; otherwise return the - # absolute path; we prefer registering resource specifications - # over absolute paths because these can be overridden by the - # resource directive. + # we prefer registering resource specifications over absolute + # paths because these can be overridden by the resource directive. if ':' in path and not os.path.isabs(path): # it's already a resource specification return path abspath = context.path(path) if hasattr(context, 'package') and context.package: - package = context.package - if getattr(package, '__name__', None) == '__main__': - return abspath - pp = package_path(package) + os.path.sep - if abspath.startswith(pp): - relpath = abspath[len(pp):] - return '%s:%s' % (package.__name__, - relpath.replace(os.path.sep, '/')) + return resource_spec_from_abspath(abspath, context.package) return abspath def zcml_configure(name, package): |
