首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有自定义视图的遍历错误

具有自定义视图的遍历错误
EN

Stack Overflow用户
提问于 2012-07-12 17:04:39
回答 1查看 436关注 0票数 2

使用定制产品处理Plone 3.3.6实例,该产品应该显示flv类型的视频。我正试图找出从哪里开始排除这个遍历错误。我确信这是在使用Plone 3.1.x (虽然我有很好的想象力)。

代码语言:javascript
复制
TraversalError: (<Products.Five.viewlet.metaconfigure.MyFormWrapper object at 0xe4c36cc>, 'contents') 

我已经包括了以下的回溯:

代码语言:javascript
复制
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与较旧版本的hachoir软件包不兼容,在实例正常启动之前,我至少需要1.2.1软件包。我的构建配置的版本部分现在包括以下内容。

,但它似乎与plone.app.z3cform有关

代码语言:javascript
复制
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 )。
  2. 对于pin版本,http://good-py.appspot.com是一个绝对的生命保护程序( plone.app.z3cform 0.4.3没有选择pin,但是0.4.9已经足够接近了)。因此,我仍然必须显式地将0.4.3引脚在构建的版本部分。
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-13 11:32:21

回答我自己的问题。

这个问题与视图有关,与我试图访问的视图相关。

视图在一个名为“assessment_input”的模板中引用了一个自定义的assessment_input,因此是跟踪的这一部分:

代码语言:javascript
复制
- URL: assessment_input
- Line 12, Column 4

我知道这一点是肯定的,因为当我在我的自定义产品的browser/figre.zcml中注释掉这个令人反感的视图时,视图就开始工作了(当然没有显示视图)。

基于z3c.form的表单在plone.z3cform版本0.5.8和更高版本中更改的呈现方式(这里记录在这里:https://dev.plone.org/ticket/10022),在0.5.8之前的plone.z3cform版本中,过去可以通过在视图模板中调用"view/contents“来呈现表单。追溯意味着较新的plone.z3cform (它不支持“视图/内容”约定)导致了错误。

代码语言:javascript
复制
    - 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

代码语言:javascript
复制
[versions]
plone.z3cform = 0.5.7

正如在问题中提到的,我使用一个好集合(KGS)将plone.app.z3cform 0.4.9的版本固定在一起,我认为这是必要的,但还没有进行绝对的测试。

就目前而言,这是一个足够好的解决方案,接下来我需要为更新版本的产品重写我的视图,以便当我升级到Plone 4.x时,viewlet支持plone.z3cform的更新的、可以说更好的呈现表单的方法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11456930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档