I have a custom template for news items defined using a BrowserView overriding the default template in Plone’s skin layer. We also have CMFEditions installed. Trying to view a previous revision results in an error as discussed in this Plone bug. We’re in the process of upgrading to Plone 3.3.6 so the “fix” describe there is in place but I’m still seeing the “view this revision” link and it still results in an error
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 Products.PloneHotfix20110531, line 106, in _patched_bindAndExec
Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 216, in _exec
Module Products.CacheSetup.patch_cmf, line 51, in FSPT_pt_render
Module Products.CacheSetup.patch_cmf, line 126, in PT_pt_render
- Warning: Macro expansion failed
- Warning: exceptions.KeyError: 'view_macro'
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 891, in do_useMacro
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 536, in do_optTag_tal
Module zope.tal.talinterpreter, line 521, in do_optTag
Module zope.tal.talinterpreter, line 516, in no_tag
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 957, in do_defineSlot
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 536, in do_optTag_tal
Module zope.tal.talinterpreter, line 521, in do_optTag
Module zope.tal.talinterpreter, line 516, in no_tag
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 861, in do_defineMacro
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 957, in do_defineSlot
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 536, in do_optTag_tal
Module zope.tal.talinterpreter, line 521, in do_optTag
Module zope.tal.talinterpreter, line 516, in no_tag
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 949, in do_defineSlot
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 855, in do_condition
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 822, in do_loop_tal
Module zope.tales.tales, line 685, in setRepeat
Module zope.tales.tales, line 101, in __init__
TypeError: iteration over non-sequence
My question is how do I change my template to get this working. The template file used by the BrowserView is a close match to the original and defines a main macro. I’m pretty sure there is no problem with it as if I replace it with the following blank template I still get exactly the same error.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="plone">
<body>
<div metal:fill-slot="main">
<tal:main-macro metal:define-macro="main">
</tal:main-macro>
</div>
</body>
</html>
Using Products.PDBDebugMode I can debug further and find
TypeError: iteration over non-sequence
> c:\plone\parts\zope2\lib\python\zope\tales\tales.py(101)__init__()
-> self._iter = i = iter(seq)
(Pdb) a
self = <Products.PageTemplates.Expressions.PathIterator object at 0x0B2FE350>
name = vdata
seq = <Products.CMFEditions.ZVCStorageTool.ShadowHistory object at 0x0B28C370>
context = <Products.PageTemplates.Expressions.ZopeContext object at 0x0B2E3DD0>
seq here has no iter or getitem method and so iter() raises a TypeError. This error is originating from the versions_history_form.pt
<tal:block repeat="vdata history">
Sorry looks like this is a bug in my code rather than anything else. I was overriding the template and the bug was originating in the bit of code where the override was – I hadn’t synchronized changes in Plone 3.3.6 correctly.
This question should probably be deleted