[Zope3-checkins] CVS: Zope3/src/zope/app/services - view.py:1.14 zpt.py:1.8
Godefroid Chapelle
gotcha@swing.be
Tue, 25 Mar 2003 06:23:40 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv20400/app/services
Modified Files:
view.py zpt.py
Log Message:
merging template_usage branch
connection to menu usage still to be done
=== Zope3/src/zope/app/services/view.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/services/view.py:1.13 Sun Mar 23 17:35:41 2003
+++ Zope3/src/zope/app/services/view.py Tue Mar 25 06:23:09 2003
@@ -12,8 +12,6 @@
#
##############################################################################
"""View Service
-
-
$Id$
"""
__metaclass__ = type
@@ -346,5 +344,7 @@
self.template = template
self.view = view
- def __call__(self, *args, **kw):
+ def __call__(self, template_usage=u'', *args, **kw):
+ if not template_usage:
+ kw["template_usage"] = template_usage
return self.template.render(self.view, *args, **kw)
=== Zope3/src/zope/app/services/zpt.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/services/zpt.py:1.7 Tue Mar 11 11:11:22 2003
+++ Zope3/src/zope/app/services/zpt.py Tue Mar 25 06:23:09 2003
@@ -46,6 +46,22 @@
lambda self, text: self.pt_edit(text.encode('utf-8'), self.contentType)
)
+ def setUsage(self, usage):
+ self._usage = usage
+
+ def getUsage(self):
+ usage = ''
+ if hasattr(self, "_usage"):
+ usage = self._usage
+ return usage
+
+ usage = property(
+ # get
+ getUsage,
+ # set
+ setUsage
+ )
+
def pt_getContext(self, view, **_kw):
# instance is a View component
namespace = super(ZPTTemplate, self).pt_getContext(**_kw)
@@ -58,6 +74,8 @@
if args:
args = ProxyFactory(args)
+ if not hasattr(keywords, "template_usage"):
+ keywords["template_usage"] = view.request.get("template_usage", self.usage)
kw = ProxyFactory(keywords)
namespace = self.pt_getContext(view, args=args, options=kw)