Ticket #11533 (reopened Bug)

Opened 5 years ago

Last modified 3 years ago

Saving object with "Related Items" throws ReferenceException: Invalid target UID

Reported by: trs22 Owned by:
Priority: major Milestone:
Component: Unknown Version: 4.1
Keywords: Cc: trs22, gforcada

Description

Steps to reproduce:

  • Create empty Plone 4.0.3 site
  • Add two Pages ('Page One', 'Page Two')
  • Edit 'Page Two'.
  • Under Categorization, add 'Page One' as a Related Item.
  • Using Firebug, note existing 'value' of 'input' element:
    <input type="checkbox" value="836f6a12f404caf5cd17944fe6afa117" name="relatedItems:list">
    
  • Save
  • Edit 'Page Two'
  • Under Categorization tab, using Firebug, note missing 'value' of 'input' element:
    <input type="checkbox" name="relatedItems:list" checked="checked" originalvalue="">
    
  • Save
  • Note error traceback:
    Traceback (innermost last):
      Module ZPublisher.Publish, line 127, in publish
      Module ZPublisher.mapply, line 77, in mapply
      Module ZPublisher.Publish, line 47, in call_object
      Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
      Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
      Module Products.CMFFormController.ControllerBase, line 231, in getNext
      Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
      Module ZPublisher.mapply, line 77, in mapply
      Module ZPublisher.Publish, line 47, in call_object
      Module Products.CMFFormController.FSControllerPythonScript, line 107, in __call__
      Module Products.CMFFormController.ControllerBase, line 231, in getNext
      Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
      Module ZPublisher.mapply, line 77, in mapply
      Module ZPublisher.Publish, line 47, in call_object
      Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
      Module Products.CMFFormController.Script, line 145, in __call__
      Module Products.CMFCore.FSPythonScript, line 130, in __call__
      Module Shared.DC.Scripts.Bindings, line 324, in __call__
      Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
      Module Products.PythonScripts.PythonScript, line 344, in _exec
      Module script, line 1, in content_edit
       - <FSControllerPythonScript at /reference-test/content_edit used for /reference-test/page-two>
       - Line 1
      Module Products.CMFCore.FSPythonScript, line 130, in __call__
      Module Shared.DC.Scripts.Bindings, line 324, in __call__
      Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
      Module Products.PythonScripts.PythonScript, line 344, in _exec
      Module script, line 13, in content_edit_impl
       - <FSPythonScript at /reference-test/content_edit_impl used for /reference-test/page-two>
       - Line 13
      Module Products.Archetypes.BaseObject, line 658, in processForm
      Module Products.Archetypes.BaseObject, line 648, in _processForm
       - __traceback_info__: (<ATDocument at /reference-test/page-two>, <Field relatedItems(reference:rw)>, <bound method ATDocument.setRelatedItems of <ATDocument at /reference-test/page-two>>)
      Module Products.Archetypes.utils, line 152, in mapply
      Module Products.Archetypes.ClassGen, line 76, in generatedMutator
      Module Products.Archetypes.Field, line 1873, in set
       - __traceback_info__: (<ATDocument at /reference-test/page-two>, 'on', ['on', ''], ['836f6a12f404caf5cd17944fe6afa117'])
      Module Products.Archetypes.ReferenceEngine, line 319, in addReference
    ReferenceException: Invalid target UID
    

It appears that, because there is no 'value' in the 'input' element, the 'target' being passed is not an object, but the string 'on'. These are the lines that are throwing the error:

# Products/Archetypes/ReferenceEngine.py, line 319:

tID, tobj = self._uidFor(target)
if not tID or tobj is None:
    raise ReferenceException('Invalid target UID')

However, the real issue probably lies in the code that is creating that form without the UID in the 'value' attribute. I verified that the 'value' attribute is set this way in Plone 3.

Attachments

Screen shot 2013-05-02 at 4.09.50 PM.png Download (29.2 KB) - added by deesto 3 years ago.
site specs

Change History

comment:1 Changed 5 years ago by mosx86

Not able to reproduce in Plone 4.0.3 / Zope 2.12.14 / Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] built using generic paster buildout.

comment:2 Changed 5 years ago by trs22

I checked with a some folks on #weblion, and they weren't able to reproduce it either. And, when I started out with plain vanilla install, it worked fine for me.

I started paring down products, and it looks like I can reproduce this when plone.app.discussion 1.0RC2 is included in the buildout, but it works fine when it isn't included.

I'm wondering if it's something in plone.app.discussion or one of its dependencies that's causing this issue.

The additional eggs that are included by including plone.app.discussion are:

collective.autopermission-1.0b1-py2.6.egg
collective.monkeypatcher-1.0-py2.6.egg
collective.z3cform.datetimewidget-1.0.4-py2.6.egg
plone.app.discussion-1.0RC2-py2.6.egg
plone.app.registry-1.0b5-py2.6.egg
plone.app.uuid-1.0b2-py2.6.egg
plone.app.z3cform-0.5.3-py2.6.egg
plone.autoform-1.0b6-py2.6.egg
plone.registry-1.0b4-py2.6.egg
plone.supermodel-1.0b6-py2.6.egg
plone.uuid-1.0b2-py2.6.egg
plone.z3cform-0.7.2-py2.6.egg
z3c.batching-1.1.0-py2.6.egg
z3c.form-2.3.3-py2.6.egg
z3c.formwidget.query-0.5-py2.6.egg

(from diff'ing the bin/client1 files before and after adding plone.app.discussion)

Thanks!

--Tim

comment:3 Changed 5 years ago by gforcada

  • Cc gforcada added

Same happens here. Instead of adding plone.app.discussion I added plone.app.referenceablebehavior.

The common root seems plone.app.uuid or any uuid thingie.

comment:4 in reply to: ↑ description Changed 5 years ago by rafaeltcc

  • Priority changed from minor to major

I am experiencing this problem. plone.app.discussion broke my site and I can't uninstall it (I saw a buig rejected because iot is intended to be a core product, so no uninstallation script).. What can I do? this can't be a minor priority because it broke my site..

comment:5 Changed 5 years ago by rafaeltcc

Hi, just found a solution.. update to archetypes.referencebrowserwidget 2.4

Credits o davisagli

comment:6 Changed 5 years ago by esteele

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

archetypes.referencebrowserwidget 2.4 will be used in the soon-to-be-released 4.0.6. I'll consider this closed. Feel free to reopen if that's not the case.

Changed 3 years ago by deesto

site specs

comment:7 Changed 3 years ago by deesto

  • Status changed from closed to reopened
  • Version set to 4.1
  • Resolution fixed deleted

Apologies for raising the dead, but adding a "related items" to an otherwise valid page object causes the same error in 4.1.6.

Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
  Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
  Module Products.CMFFormController.ControllerBase, line 231, in getNext
  Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line 107, in __call__
  Module Products.CMFFormController.ControllerBase, line 231, in getNext
  Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
  Module Products.CMFFormController.Script, line 145, in __call__
  Module Products.CMFCore.FSPythonScript, line 127, in __call__
  Module Shared.DC.Scripts.Bindings, line 322, in __call__
  Module Products.PloneHotfix20121106.python_scripts, line 63, in _patched_bindAndExec
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 344, in _exec
  Module script, line 1, in content_edit
   - <FSControllerPythonScript at /webdocs/content_edit used for /webdocs/docs/howto/retire-workstation>
   - Line 1
  Module Products.CMFCore.FSPythonScript, line 127, in __call__
  Module Shared.DC.Scripts.Bindings, line 322, in __call__
  Module Products.PloneHotfix20121106.python_scripts, line 63, in _patched_bindAndExec
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 344, in _exec
  Module script, line 13, in content_edit_impl
   - <FSPythonScript at /webdocs/content_edit_impl used for /webdocs/docs/howto/retire-workstation>
   - Line 13
  Module Products.Archetypes.BaseObject, line 658, in processForm
  Module Products.Archetypes.BaseObject, line 648, in _processForm
   - __traceback_info__: (<ATDocument at /webdocs/docs/howto/retire-workstation>, <Field relatedItems(reference:rw)>, <bound method ATDocument.setRelatedItems of <ATDocument at /webdocs/docs/howto/retire-workstation>>)
  Module Products.Archetypes.utils, line 120, in mapply
  Module Products.Archetypes.ClassGen, line 76, in generatedMutator
  Module Products.Archetypes.Field, line 1890, in set
   - __traceback_info__: (<ATDocument at /webdocs/docs/howto/retire-workstation>, '124931c84ec3bd4174046bee45266220', ['124931c84ec3bd4174046bee45266220', ''], [])
  Module Products.Archetypes.ReferenceEngine, line 308, in addReference
ReferenceException: Invalid target UID

Note: See TracTickets for help on using tickets.