[Zope-CMF] errors in FS PT

Florent Guillaume fg at nuxeo.com
Mon Aug 23 10:31:21 EDT 2004


CMFCore/FSPageTemplate.py has this code:

     def pt_render(self, source=0, extra_context={}):
         ...
         try:
             result = FSPageTemplate.inheritedAttribute('pt_render')(
                                     self, source, extra_context)
             ...
             return result

         except RuntimeError:
             if Globals.DevelopmentMode:
                 err = FSPageTemplate.inheritedAttribute('pt_errors')(
                                      self)
                 if not err:
                     err = sys.exc_info()
                 err_type = err[0]
                 err_msg = '<pre>%s</pre>' % replace(
                                     str(err[1]), "\'", "'" )
                 msg = 'FS Page Template %s has errors: %s.<br>%s' % (
                     self.id, err_type, html_quote(err_msg) )
                 raise RuntimeError, msg
             else:
                 raise


This codes actully dumbs down error in debug mode to a simple "there are 
errors" without detailed info, and leaves the complete useful traceback 
in non-debug mode. I feel this is backwards. In development mode I want 
to view the whole traceback, with the details of where in what macro 
there is a problem! And in non-debug mode few people see the errors anyway.

In all my development instances I've added a 'raise' after the except 
because it prevents me from finding bugs.

I want to change the test to its opposite. Anyone against that? I could 
even remove the dumbing down altogether.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 71 59  http://nuxeo.com  mailto:fg at nuxeo.com


More information about the Zope-CMF mailing list