[Zope3-checkins] CVS: Zope3/src/zope/app/services - view.py:1.7.4.1 zpt.py:1.6.4.1
Godefroid Chapelle
gotcha@swing.be
Fri, 14 Mar 2003 10:46:25 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv18199/app/services
Modified Files:
Tag: template_usage-branch
view.py zpt.py
Log Message:
service view now usage aware
=== Zope3/src/zope/app/services/view.py 1.7 => 1.7.4.1 ===
--- Zope3/src/zope/app/services/view.py:1.7 Fri Feb 21 09:50:04 2003
+++ Zope3/src/zope/app/services/view.py Fri Mar 14 10:45:54 2003
@@ -318,5 +318,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.6 => 1.6.4.1 ===
--- Zope3/src/zope/app/services/zpt.py:1.6 Tue Feb 11 10:59:56 2003
+++ Zope3/src/zope/app/services/zpt.py Fri Mar 14 10:45:54 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)