[Zope] PageTemplates len() of unsized object

Dieter Maurer dieter at handshake.de
Wed May 28 14:48:19 EDT 2008


Giampiero Benvenuti wrote at 2008-5-24 11:47 +0200:
> ...
>after the upgrade from zope2.9.7 to 2.10.6 i get this error in the  
>event log:
>
>2008-05-24T09:31:32 ERROR Zope.SiteErrorLog http://myurl/error_log/manage_main
>Traceback (innermost last):
>   Module ZPublisher.Publish, line 119, in publish
>   Module ZPublisher.mapply, line 88, in mapply
>   Module ZPublisher.Publish, line 42, in call_object
>   Module Shared.DC.Scripts.Bindings, line 313, in __call__
>   Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
>   Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
>   Module Products.PageTemplates.PageTemplate, line 89, in pt_render
>   Module zope.pagetemplate.pagetemplate, line 117, in pt_render
>   Module zope.tal.talinterpreter, line 271, in __call__
>   Module zope.tal.talinterpreter, line 346, in interpret
>   Module zope.tal.talinterpreter, line 379, in do_startEndTag
>   Module zope.tal.talinterpreter, line 412, in do_startTag
>TypeError: len() of unsized object

Looks as if the Zope 2.10 PageTemplate implementation made a big
step backward with respect to quality of traceback information :-((

Shane had added lots of "__traceback_info__" and "__traceback_supplement__"
declarations to the older code such that the tracebacks were
very informative....
... unlike the traceback above.


Looking at the code of "do_startTag", I see that the problem is
with an attribute definition in a start tag.
Such an attribute definition should be evaluated into a sequence of strings
(or unicode strings).
The error happens because one of these sequence elements is
not a string, more precisely, it is something "len(...)" cannot be applied to.


Unfortunately, we would need to know the affected template,
the template line this problems occurs in (and its code)
and the attribute causing this problem.
It would be Zope's task to provide this information -- but as I have said:
it apparently made big steps backward with Zope 2.10....


You could try to add

    __traceback_info__ = name, item, rendered, s

before line 412 of "zope/tal/talinterpreter.py".

The traceback would then tell us: the name of the tag ("name"),
the attribute definition ("item"), its evaluation ("rendered")
and the problematic element.

We still would not know which PageTemplate causes the problem (but
we might guess this).



-- 
Dieter


More information about the Zope mailing list