From 750ce41f217cd7b638ad5b69fcb9df1b49841b58 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 17 Sep 2009 19:58:01 +0000 Subject: - Add a ``repoze.bfg.url.static_url`` API which is capable of generating URLs to static resources defined by the ```` ZCML directive. See the "Views" narrative chapter's section titled "Generating Static Resource URLs" for more information. --- repoze/bfg/zcml.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'repoze/bfg/zcml.py') 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( -- cgit v1.2.3