diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-09-17 19:58:01 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-09-17 19:58:01 +0000 |
| commit | 750ce41f217cd7b638ad5b69fcb9df1b49841b58 (patch) | |
| tree | a0a8edbc60694d3ae16b70570b0184a8ef28ee65 /repoze/bfg/zcml.py | |
| parent | 19473e78e61ad084f07a0f7820a75b6c64d93dcd (diff) | |
| download | pyramid-750ce41f217cd7b638ad5b69fcb9df1b49841b58.tar.gz pyramid-750ce41f217cd7b638ad5b69fcb9df1b49841b58.tar.bz2 pyramid-750ce41f217cd7b638ad5b69fcb9df1b49841b58.zip | |
- Add a ``repoze.bfg.url.static_url`` API which is capable of
generating URLs to static resources defined by the ``<static>`` ZCML
directive. See the "Views" narrative chapter's section titled
"Generating Static Resource URLs" for more information.
Diffstat (limited to 'repoze/bfg/zcml.py')
| -rw-r--r-- | repoze/bfg/zcml.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index fd8e086a4..8ad0c3ec9 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -51,6 +51,8 @@ from repoze.bfg.security import Unauthorized from repoze.bfg.settings import get_settings +from repoze.bfg.static import StaticRootFactory + from repoze.bfg.traversal import find_interface from repoze.bfg.view import static as static_view @@ -611,10 +613,6 @@ class IStaticDirective(Interface): required=False, default=None) -class StaticRootFactory: - def __init__(self, environ): - pass - def static(_context, name, path, cache_max_age=3600): """ Handle ``static`` ZCML directives """ @@ -626,7 +624,7 @@ def static(_context, name, path, cache_max_age=3600): view = static_view(path, cache_max_age=cache_max_age) route(_context, name, "%s*subpath" % name, view=view, - view_for=StaticRootFactory, factory=StaticRootFactory) + view_for=StaticRootFactory, factory=StaticRootFactory(path)) class IViewDirective(Interface): for_ = GlobalObject( |
