Ticket #14027 (reopened Bug)

Opened 2 years ago

Last modified 18 months ago

Regression with Dexterity RelationChoice field in Plone 4.3.3

Reported by: nutjob Owned by: davisagli
Priority: major Milestone: 4.x
Component: Dexterity Version: 4.3
Keywords: Cc:

Description

Using a RelationChoice field in a Dexterity type suddenly fails to render "Add" forms in Plone 4.3.3. This was working in Plone 4.3.2.

For example, adding this field to a Dexterity type:

    references = RelationChoice(
        title=u'References',
        source=ObjPathSourceBinder(portal_type='Document'),
        required=False,
    )

Will make Plone 4.3.3 produce the following stack trace:

2014-04-22 09:05:22 ERROR Zope.SiteErrorLog 1398175522.680.167608108016 http://localhost:8080/p2/++add++bug.relationchoice.sample
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.z3cform.layout, line 66, in __call__
  Module plone.z3cform.layout, line 60, in update
  Module z3c.form.form, line 263, in render
  Module z3c.form.form, line 158, in render
  Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
. . .
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/kelly/.buildout/eggs/plone.app.z3cform-0.7.6-py2.7.egg/plone/app/z3cform/templates/macros.pt
   - Line 97, Column 46
   - Expression: <PathExpr standard:u'widget/@@ploneform-render-widget'>
   - Names:
      {'args': (),
       'context': <PloneSite at /p2>,
       'default': <object object at 0x10ba95b70>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <HTTPRequest, URL=http://localhost:8080/p2/++add++bug.relationchoice.sample>,
       'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x10fa9a650>,
       'view': <plone.dexterity.browser.add.DefaultAddForm object at 0x111683410>,
       'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x111729b90>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 155, in _eval
  Module Products.PageTemplates.Expressions, line 117, in render
  Module Products.Five.browser.metaconfigure, line 479, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 83, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
. . .
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/kelly/.buildout/eggs/plone.app.z3cform-0.7.6-py2.7.egg/plone/app/z3cform/templates/widget.pt
   - Line 37, Column 4
   - Expression: <PathExpr standard:u'widget/render'>
   - Names:
      {'args': (),
       'context': <ContentTreeWidget 'form.widgets.references'>,
       'default': <object object at 0x10ba95b70>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <HTTPRequest, URL=http://localhost:8080/p2/++add++bug.relationchoice.sample>,
       'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x10fb3c750>,
       'view': <Products.Five.metaclass.RenderWidget object at 0x111759e90>,
       'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x111759f50>}
  Module zope.tales.expressions, line 217, in __call__
  Module zope.tales.expressions, line 211, in _eval
  Module plone.formwidget.contenttree.widget, line 168, in render
  Module zope.browserpage.viewpagetemplatefile, line 83, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
. . .
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/kelly/.buildout/eggs/plone.formwidget.contenttree-1.0.7-py2.7.egg/plone/formwidget/contenttree/input.pt
   - Line 3, Column 5
   - Expression: <PathExpr standard:u'view/renderQueryWidget'>
   - Names:
      {'args': (<ContentTreeWidget 'form.widgets.references'>,),
       'context': <PloneSite at /p2>,
       'default': <object object at 0x10ba95b70>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <HTTPRequest, URL=http://localhost:8080/p2/++add++bug.relationchoice.sample>,
       'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x10f5e6210>,
       'view': <ContentTreeWidget 'form.widgets.references'>,
       'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x111760190>}
  Module zope.tales.expressions, line 217, in __call__
  Module zope.tales.expressions, line 211, in _eval
  Module z3c.formwidget.query.widget, line 212, in renderQueryWidget
  Module z3c.form.widget, line 153, in render
  Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
. . .
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /Users/kelly/.buildout/eggs/z3c.form-3.1.1-py2.7.egg/z3c/form/browser/radio_input.pt
   - Line 8, Column 4
   - Expression: <PythonExpr (view.renderForValue(item['value']))>
   - Names:
      {'args': (),
       'context': <PloneSite at /p2>,
       'default': <object object at 0x10ba95b70>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <HTTPRequest, URL=http://localhost:8080/p2/++add++bug.relationchoice.sample>,
       'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x10faf2950>,
       'view': <ContentTreeWidget 'form.widgets.references'>,
       'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x10c04ef10>}
  Module zope.tales.pythonexpr, line 59, in __call__
   - __traceback_info__: (view.renderForValue(item['value']))
  Module <string>, line 1, in <module>
  Module z3c.form.browser.radio, line 44, in renderForValue
  Module z3c.form.term, line 38, in getTermByToken
  Module zope.schema.vocabulary, line 133, in getTermByToken
LookupError: --NOVALUE--

For a small reproducible example, visit  https://github.com/nutjob4life/bug.relationchoice

Attachments

z3c.form.patch Download (1.0 KB) - added by puittenbroek 18 months ago.
Patch file for buildout

Change History

comment:1 Changed 2 years ago by jensens

Just had the same problem. It works with z3c.form 3.0.3, break with 3.0.4

comment:3 Changed 2 years ago by ida

  • Status changed from new to closed
  • Resolution set to invalid

comment:4 Changed 2 years ago by ida

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:5 Changed 2 years ago by ida

Sorry closed this in a mass attempt to get rid of spam accidently, now reopened.

comment:7 Changed 21 months ago by seanupton

I should clarify what I saw, regarding versions and a workaround: pinning a Plone 4.3.3 build to use z3c.form 3.0.5 instead of 3.1.1 seams to solve the problem. I am pretty sure that the issue was introduced after 3.0.5 and that any version <= 3.0.5 will not have this issue.

comment:8 Changed 21 months ago by saily

same problem here

comment:9 Changed 21 months ago by maartenkling

same problem here, everything work fine in jenkins and now test fail when using z3c.form-3.1.1 and plone.formwidget.contenttree-1.0.7 any ideas how to fix this?

Module zope.tales.tales, line 696, in evaluate

  • URL: /var/lib/jenkins/.buildout/eggs/z3c.form-3.1.1-py2.7.egg/z3c/form/browser/radio_input.pt
  • Line 8, Column 4
  • Expression: <PythonExpr (view.renderForValue(itemvalue?))>
  • Names:

{'args': (),

'context': <OrganisationFolder at /plone/organisations>, 'default': <object object at 0x16112d0>, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': <HTTPRequest, URL= http://localhost:55001/plone/organisations/++add++xxx>, 'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x812a650>, 'view': <ContentTreeWidget 'form.widgets.accountmanager'>, 'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x7fecd0abcc10>}

Module zope.tales.pythonexpr, line 59, in call

  • traceback_info: (view.renderForValue(itemvalue?))

Module <string>, line 1, in <module> Module z3c.form.browser.radio, line 44, in renderForValue Module z3c.form.term, line 38, in getTermByToken Module zope.schema.vocabulary, line 133, in getTermByToken

LookupError: --NOVALUE--

comment:10 Changed 18 months ago by puittenbroek

Pinning z3c.form = 3.0.5 seems to be the only working solution at the moment.
Unless you want to manually patch z3c.form as described  here

comment:11 Changed 18 months ago by puittenbroek

Example how to patch it via buildout

parts +=
    z3c-form-patch

[z3c-form-patch]
recipe = collective.recipe.patch
egg = z3c.form==3.1.1
patches = patches/z3c.form.patch

Changed 18 months ago by puittenbroek

Patch file for buildout

Note: See TracTickets for help on using tickets.