[Checkins] SVN: five.pt/trunk/src/five/pt/pagetemplate.py Add the possiblity to have a default namespace (for grok integration).
Sylvain Viollon
sylvain at infrae.com
Mon Oct 6 13:59:38 EDT 2008
Log message for revision 91816:
Add the possiblity to have a default namespace (for grok integration).
Changed:
U five.pt/trunk/src/five/pt/pagetemplate.py
-=-
Modified: five.pt/trunk/src/five/pt/pagetemplate.py
===================================================================
--- five.pt/trunk/src/five/pt/pagetemplate.py 2008-10-06 17:58:53 UTC (rev 91815)
+++ five.pt/trunk/src/five/pt/pagetemplate.py 2008-10-06 17:59:37 UTC (rev 91816)
@@ -38,7 +38,7 @@
path = package_home(_prefix)
return path
- def render(self, view):
+ def render(self, view, default_namespace=None):
try:
root = self.getPhysicalRoot()
except AttributeError:
@@ -47,10 +47,10 @@
except AttributeError:
root = None
- context = aq_inner(view.context)
+ context = aq_inner(view.context)
def template(*args, **kwargs):
- return self.template.render(
+ namespace = dict(
view=view,
context=context,
request=view.request,
@@ -63,6 +63,9 @@
modules=SecureModuleImporter,
views=ViewMapper(context, view.request),
options=kwargs)
+ if default_namespace:
+ namespace.update(default_namespace)
+ return self.template.render(**namespace)
return template
More information about the Checkins
mailing list