[ZCM] [ZC] 1325/ 1 Request "PageTemplates - wrong exceptions to
signal compilation problems"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Mon May 10 22:10:11 EDT 2004
Issue #1325 Update (Request) "PageTemplates - wrong exceptions to signal compilation problems"
Status Pending, Zope/bug+solution medium
To followup, visit:
http://zope.org/Collectors/Zope/1325
==============================================================
= Request - Entry #1 by limi on May 10, 2004 10:10 pm
(Relaying from Dieter on the Archetypes Developer mailing list)
"PageTemplates" (and "FSPageTemplate") use "RuntimeError" to signal
compilation problems. Correspondingly, they catch such
exceptions and treat them specially (store summary info in "self.errors"
and show this info in a small note above the source).
However, "RuntimeError" is a standard Python exception used for
various other purposes. If such an exception occurs during
PageTemplate evaluation, the exception is mistreated by
"PageTemplates" (treated as if it were a compilation problem).
This makes analysing such problems much more difficult.
"PageTemplates" should use their own specialized exception
to signal compilation problems or catch "RuntimeError"
only during compilation but not during evaluation.
More background:
> That is from the traceback. Unfortunatley, the information is quite limited:
> ...
> Module Products.CMFCore.FSPageTemplate, line 140, in pt_render
> RuntimeError: FS Page Template manage_translations_form has errors:
> exceptions.RuntimeError.<br><pre>function attributes not
> accessible in restricted mode
Bah, a bad design of "PageTemplate"s. They should not have used
"RuntimeError" to indicate problems with the template...
When I hit such a situation, I modify "line 140" of "CMFCore/FSPageTemplate.py"
and log the true traceback. Usually, this quickly reveals the problem.
==============================================================
More information about the Zope-Collector-Monitor
mailing list