[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.30.2.2
Shane Hathaway
shane@cvs.zope.org
Mon, 4 Mar 2002 18:23:26 -0500
Update of /cvs-repository/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv22747
Modified Files:
Tag: shane-better-tracebacks-branch
ZopePageTemplate.py
Log Message:
- Made sure the template gets cooked before showing errors
- Hooked up the source file machinery for ZopePageTemplates by overriding
pt_source_file.
=== Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.30.2.1 => 1.30.2.2 ===
icons = ({'path': 'misc_/PageTemplates/zpt.gif',
'alt': self.meta_type, 'title': self.meta_type},)
+ if not self._v_cooked:
+ self._cook()
if self._v_errors:
icons = icons + ({'path': 'misc_/PageTemplates/exclamation.gif',
'alt': 'Error',
@@ -265,8 +267,18 @@
return icons
def __setstate__(self, state):
+ # This is here for backward compatibility. :-(
ZopePageTemplate.inheritedAttribute('__setstate__')(self, state)
- self._cook()
+
+ def pt_source_file(self):
+ """Returns a file name to be compiled into the TAL code."""
+ try:
+ # URL-like syntax.
+ return 'traversal:' + '/'.join(self.getPhysicalPath())
+ except:
+ # This page template is being compiled without an
+ # acquisition context, so we don't know where it is. :-(
+ return None
if not SUPPORTS_WEBDAV_LOCKS:
def wl_isLocked(self):