PageTemplates len() of unsized object
Hello list, 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 If I click on ZMI "error_log" i just get: Error Type: TypeError Error Value: len() of unsized object Can someone explain to me what is going on? Your help is very much appreciated. Giampiero
--On 24. Mai 2008 11:47:32 +0200 Giampiero Benvenuti <giampiero.benvenuti@chiaroscuro.com> wrote:
Hello list,
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
If I click on ZMI "error_log" i just get:
Error Type: TypeError Error Value: len() of unsized object
You might take the Python debugger and figure out why do_startTag() is failing. This might help us for providing a fix or a workaround. Without further information e.g. the related content of the template or the related tag failing here...there is little we can do - except guessing (I won't). Andreas
Thanks Andreas, unfortunately, your advice to use Python debugger is way over my head. I'm a web designer, I can deal with Zope and python up to some level (medium/low?)...sometime with Zope even the level of knowledge of it is openable :-( Thanks anyhow, Giampiero On May 24, 2008, at 11:52 AM, Andreas Jung wrote:
--On 24. Mai 2008 11:47:32 +0200 Giampiero Benvenuti <giampiero.benvenuti@chiaroscuro.com
wrote:
Hello list,
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
If I click on ZMI "error_log" i just get:
Error Type: TypeError Error Value: len() of unsized object
You might take the Python debugger and figure out why do_startTag() is failing. This might help us for providing a fix or a workaround. Without further information e.g. the related content of the template or the related tag failing here...there is little we can do - except guessing (I won't).
Andreas
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
Thanks Dieter, I was able to "solve" the problem by uninstalling all the products. By trial and error I found out the problem was caused by the Placeless Translation Service product. Maybe there was some dependency from something else; I can't tell. I just got rid of it and now everything works as normal. Thanks anyhow, Giampiero On May 28, 2008, at 8:48 PM, Dieter Maurer wrote:
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
Dieter Maurer wrote:
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 :-((
As far as I can see, traceback information was never added within the TAL interpreter but always for TALES expression evalutation. The traceback above seems to be about something going wrong within the TAL interpreter which is probably why we don't see any further traceback info.
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.
As far as I can tell, the code in zope.pagetemplate and zope.tales still has the same traceback information that Products.PageTemplate had. zope.tal, which contains the TAL interpreter, doesn't have any traceback supplements, but then again, Zope 2's TAL package doesn't either. To conclude, I don't think there's a "step backward" at all.
Philipp von Weitershausen wrote at 2008-5-28 21:52 +0200:
Dieter Maurer wrote:
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 ... As far as I can tell, the code in zope.pagetemplate and zope.tales still has the same traceback information that Products.PageTemplate had. zope.tal, which contains the TAL interpreter, doesn't have any traceback supplements, but then again, Zope 2's TAL package doesn't either.
To conclude, I don't think there's a "step backward" at all.
The Zope 2.9 code had traceback support in "PageTemplate.pt_render" which told us which template was affected. As you can see in the traceback above, at least this traceback support is lost in Zope 2.10. To conclude: "no step backward at all" is incorrect. Looking at Zope 2.11, the traceback support above seems to have been resurrected. Furthermore, I could not find the equivalent of the transback support which formerly was in "Expressions.py" (I found the one corresponding to "TALES" and "PythonExpr"). -- Dieter
On 2 Jun 2008, at 20:44 , Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2008-5-28 21:52 +0200:
Dieter Maurer wrote:
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 ... As far as I can tell, the code in zope.pagetemplate and zope.tales still has the same traceback information that Products.PageTemplate had. zope.tal, which contains the TAL interpreter, doesn't have any traceback supplements, but then again, Zope 2's TAL package doesn't either.
To conclude, I don't think there's a "step backward" at all.
The Zope 2.9 code had traceback support in "PageTemplate.pt_render" which told us which template was affected. As you can see in the traceback above, at least this traceback support is lost in Zope 2.10.
To conclude: "no step backward at all" is incorrect.
Looking at Zope 2.11, the traceback support above seems to have been resurrected.
Furthermore, I could not find the equivalent of the transback support which formerly was in "Expressions.py" (I found the one corresponding to "TALES" and "PythonExpr").
Thank you for that careful analysis. I was only comparing Zope 2.9 with Zope 3 (which are AFAICT equivalent in their traceback info) but I didn't take 2.10 into consideration. I've now filed a bug report at https://bugs.launchpad.net/zope2/+bug/236938 to make sure the issue isn't lost. I will look into it a.s.a.p.
participants (4)
-
Andreas Jung -
Dieter Maurer -
Giampiero Benvenuti -
Philipp von Weitershausen