[Zope3-checkins] CVS: Zope3/src/zope/app/services - zpt.py:1.9
Jim Fulton
jim@zope.com
Wed, 2 Apr 2003 14:48:51 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv32547
Modified Files:
zpt.py
Log Message:
Template usage wasn't handled correctly. This caused page rendering
to fail whan no usage was specified.
=== Zope3/src/zope/app/services/zpt.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/zpt.py:1.8 Tue Mar 25 06:23:09 2003
+++ Zope3/src/zope/app/services/zpt.py Wed Apr 2 14:48:20 2003
@@ -38,6 +38,7 @@
contentType = 'text/html'
expand = False
+ usage = u''
source = property(
# get
@@ -46,22 +47,6 @@
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)
@@ -74,8 +59,13 @@
if args:
args = ProxyFactory(args)
- if not hasattr(keywords, "template_usage"):
- keywords["template_usage"] = view.request.get("template_usage", self.usage)
+
+ if self.usage:
+ if "template_usage" not in keywords:
+ kw = {'template_usage': self.usage}
+ kw.update(keywords)
+ keywords = kw
+
kw = ProxyFactory(keywords)
namespace = self.pt_getContext(view, args=args, options=kw)