У меня есть собственный шаблон для новостей, определенный с помощью BrowserView, переопределяющий шаблон по умолчанию в слое кожи Plone. У нас также установлены CMFEditions. Попытка просмотреть предыдущую ревизию приводит к ошибке, как описано в этой Plone bug . Мы находимся в процессе обновления до Plone 3.3.6, так что описание исправления существует, но я все еще вижу ссылку «просмотреть эту редакцию», и она все равно приводит к ошибке
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
Мой вопрос: как мне изменить мой шаблон, чтобы это работало? Файл шаблона, используемый BrowserView, близко соответствует оригиналу и определяет основной макрос. Я почти уверен, что с этим нет проблем, так как если я заменю его следующим пустым шаблоном, то все равно получаю точно такую же ошибку.
<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>
Используя Products.PDBDebugMode, я могу продолжить отладку и найти
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 здесь не имеет iter или getitem метода, поэтому iter () вызывает ошибку TypeError. Эта ошибка возникла из version_history_form.pt
<tal:block repeat="vdata history">