diff options
Diffstat (limited to 'repoze/bfg/zcml.py')
| -rw-r--r-- | repoze/bfg/zcml.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index e0c8d2e8e..dbc145149 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -1,3 +1,5 @@ +import os +import sys import inspect import types @@ -46,6 +48,8 @@ from repoze.bfg.security import ViewPermissionFactory from repoze.bfg.secpols import registerBBBAuthn +from repoze.bfg.static import find_package + from repoze.bfg.view import static as static_view import martian @@ -365,7 +369,11 @@ def static(_context, name, path, cache_max_age=3600): if ':' in path: package_name, path = path.split(':') else: - package_name = _context.resolve('.').__name__ + package_path = _context.resolve('.').__path__[0] + package_name = find_package(package_path) + if package_name is not None: + path = os.path.join(package_path, path) + path = path[len(sys.modules[package_name].__path__[0])+1:] view = static_view( path, cache_max_age=cache_max_age, package_name=package_name) |
