2

使用应显示 flv 类型视频的自定义产品处理 Plone 3.3.6 实例。我试图弄清楚从哪里开始解决这个遍历错误。我确定这适用于 Plone 3.1.x(尽管我确实有很好的想象力)。

TraversalError: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents') 

我在下面包含了回溯:

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 zope.formlib.form, line 770, in __call__
  Module zope.formlib.form, line 764, in render
  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.CacheSetup.patch_cmf, line 77, in PT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.PageTemplates.PageTemplate, line 98, in pt_render
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render
   - Warning: Macro expansion failed
   - Warning: exceptions.AttributeError: @@tag_macros
  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 861, in do_defineMacro
  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 855, in do_condition
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 223, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: index
   - Line 128, Column 8
   - Expression: <StringExpr 'plone.belowcontentbody'>
   - Names:
      {'container': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'context': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'default': <object object at 0xb7f33528>,
       'here': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xe3c866c>,
       'request': <HTTPRequest, URL=http://videoserver/Members/johndoe/sample-video.flv/file_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xe34dcec>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.metaclass.SimpleViewClass from /data/Plone/buildout/eggs/p4a.video-1.3-py2.4.egg/p4a/video/browser/video.pt object at 0xe4ce36c>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xe2fa86c>}
  Module Products.Five.browser.providerexpression, line 37, in __call__
  Module plone.app.viewletmanager.manager, line 154, in render
  Module plone.app.viewletmanager.manager, line 83, in render
  Module plone.app.layout.viewlets.common, line 44, in render
  Module alteroo.assesscontent.browser.viewlet, line 95, in index
  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.CacheSetup.patch_cmf, line 77, in PT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.PageTemplates.PageTemplate, line 98, 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 855, in do_condition
  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 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 223, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: assessment_input
   - Line 12, Column 4
   - Expression: <PathExpr standard:'view/contents'>
   - Names:
      {'container': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'context': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'default': <object object at 0xb7f33528>,
       'here': <ATFile at /sites/videoserver/plone/Members/johndoe/sample-video.flv>,
       'loop': {},
       'nothing': None,
       'options': {'args': (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>,)},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xe15590c>,
       'request': <HTTPRequest, URL=http://videoserver/Members/johndoe/sample-video.flv/file_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xe0dacec>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xe4bb78c>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 155, in _eval
  Module zope.tales.expressions, line 124, in _eval
  Module Products.PageTemplates.Expressions, line 105, in trustedBoboAwareZopeTraverse
  Module zope.traversing.adapters, line 164, in traversePathElement
   - __traceback_info__: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents')
  Module zope.traversing.adapters, line 52, in traverse
   - __traceback_info__: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents', [])
TraversalError: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents')

更多信息:我将 p4a.video 固定到 1.1 版,该扩展正在拉入 1.3。p4a.video 与旧版本的 hach​​oir 包不兼容,我至少需要 1.2.1 包,然后我的实例才能正常启动。我的构建配置的版本部分现在包括以下内容。

但这似乎与plone.app.z3cform有关

extends =
        ...
        http://good-py.appspot.com/release/plone.app.z3cform/0.4.9?plone=3.3.6

[versions]
p4a.plonevideoembed = 1.1
p4a.video = 1.1
hachoir-core = 1.2.1
hachoir-metadata = 1.2.1
hachoir-parser = 1.2.1

我是怎么做的:

  1. 一般来说,在前台模式下启动我的实例以进行故障排除(bin/instance fg)非常有用。
  2. http://good-py.appspot.com绝对是固定版本的救星(没有选择固定 plone.app.z3cform 0.4.3,但 0.4.9 已经足够接近了。结果我仍然必须在我的构建的 [versions] 部分中明确固定 0.4.3。
4

1 回答 1

0

回答我自己的问题。

该问题与一个 viewlet 相关,与我试图访问的视图相关联。

viewlet 在名为“assessment_input”的模板中引用了自定义 z3c.form,因此这部分回溯:

- URL: assessment_input
- Line 12, Column 4

我肯定知道这一点,因为当我通过在我的自定义产品的 browser/configure.zcml 中将其注释掉来暂时禁用有问题的 viewlet 时,视图开始工作(当然不显示 viewlet)。

在 plone 中呈现基于 z3c.form 的表单的方式在 plone.z3cform 的 0.5.8 版及更高版本中发生了变化(此处记录:https ://dev.plone.org/ticket/10022 ),在 plone 版本中.z3cform 在 0.5.8 之前,它曾经可以通过在 viewlet 模板中调用“view/contents”来呈现表单。回溯意味着较新的 ​​plone.z3cform(不支持“视图/内容”约定)导致错误。

    - Expression: <PathExpr standard:'view/contents'>

    <snip> ...

      - __traceback_info__: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents', [])
   TraversalError: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents')

修复要求我在构建中将我的 plone.z3cform 版本固定到 0.5.7

[versions]
plone.z3cform = 0.5.7

正如问题中提到的,我使用 good-py known good set (KGS) 固定了 plone.app.z3cform 0.4.9 的版本,我认为这是必要的,但还没有绝对测试过。

现在这是一个足够好的解决方案,继续前进,我需要为我的产品的更新版本重写我的 viewlet,以便当我升级到 Plone 4.x 时,viewlet 支持 plone.z3cform 的更新,并且可以说是更好的渲染方法形式。

于 2012-07-13T11:32:21.890 回答