Ticket #20287 (new Bug)

Opened 10 months ago

Dexterity behavior - issue with inconsistent behavior usage across multiple portals

Reported by: wohnlice Owned by: davisagli
Priority: minor Milestone: 4.x
Component: Dexterity Version: 4.2
Keywords: Cc:

Description

I have a simple MyContact schema, and a schema based behavior CustomContact. What I wanted to do is have a content type called Contact that would have the MyContact schema across multiple portals, but one of those would use the CustomContact behavior.

The following problem occurs: I edit a contact without the behavior and have no problem. I then edit a contact with the behavior and get the error posted at the bottom of this page. Here's the kicker - if I restart plone and edit the contact with the behavior first I do not get an error. However, I get a similar error when trying to edit a contact without the behavior - this time trying to adapt IRelatedItems.

I also noticed that this only happens if the portal type is the same across all portals on the Zope instance. If I instead rename the portal type to CustomContact and leave all other FTI the same I do not have any issues editing in any order.

It's possible this is really a bug with z3c.form. I tried delving deep into that but I am not very familiar with it.

2015-06-04 11:12:10 ERROR Zope.SiteErrorLog 1433430730.90.806871000567 http://localhost:8080/myportal/contacts/my-contact/@@edit
Traceback (innermost last):
  Module ZPublisher.Publish, line 60, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module z3c.form.form, line 215, in __call__
  Module plone.dexterity.browser.edit, line 52, in update
  Module plone.z3cform.fieldsets.extensible, line 59, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 125, in update
  Module custom.contact.browser.contact, line 67, in updateWidgets
  Module z3c.form.form, line 134, in updateWidgets
  Module z3c.form.field, line 243, in update
  Module z3c.form.datamanager, line 87, in canWrite
  Module z3c.form.datamanager, line 51, in adapted_context
TypeError: ('Could not adapt', <Contact at /myportal/contacts/wohnlich-eric>, <SchemaClass custom.contact.interfaces.behaviors.ICustomContact>)

plone.app.dexterity = 1.2.1 z3c.form = 2.5.1

Note: See TracTickets for help on using tickets.