[CMF-checkins] CVS: Products/CMFDecor - FSPageTemplate.py:1.6
Jens Vagelpohl
jens@zope.com
Tue, 27 Nov 2001 16:13:13 -0500
Update of /cvs-repository/Products/CMFDecor
In directory cvs.zope.org:/tmp/cvs-serv29535
Modified Files:
FSPageTemplate.py
Log Message:
Added code that will return more meaningful error messages
if compilation failed
(PTK Tracker issue 343)
=== Products/CMFDecor/FSPageTemplate.py 1.5 => 1.6 ===
__version__='$Revision$'[11:-2]
-from string import split
+from string import split, replace
from os import stat
import Globals, Acquisition
from DateTime import DateTime
+from DocumentTemplate.DT_Util import html_quote
from AccessControl import getSecurityManager, ClassSecurityInfo
from Shared.DC.Scripts.Script import Script
from Products.PageTemplates.PageTemplate import PageTemplate
@@ -166,8 +167,20 @@
def pt_render(self, source=0, extra_context={}):
# Tie in on an opportunity to auto-reload
self._updateFromFS()
- return FSPageTemplate.inheritedAttribute('pt_render')(self, source,
- extra_context)
+ if Globals.DevelopmentMode:
+ try:
+ return FSPageTemplate.inheritedAttribute('pt_render')( self,
+ source, extra_context )
+ except RuntimeError:
+ err = FSPageTemplate.inheritedAttribute( 'pt_errors' )( self )
+ err_type = err[0]
+ err_msg = '<pre>%s</pre>' % replace( err[1], "\'", "'" )
+ msg = 'FS Page Template %s has errors: %s.<br>%s' % (
+ self.id, err_type, err_msg )
+ raise RuntimeError, msg
+ else:
+ return FSPageTemplate.inheritedAttribute('pt_render')(self,
+ source, extra_context )
# Copy over more mothods
security.declareProtected(FTPAccess, 'manage_FTPget')