plone/plone.app.z3cform — pull request #2 by gborelli (2012-11-19 15:06:37+00:00)
Title: Integrated closest_content method from plone.app.contenttree

Following this thread - http://sourceforge.net/mailarchive/message.php?msg_id=29887036 - about how to lookup a content from a multiwidget suboform, I've tried to find the correct solution by apply a different context in these kind of subforms.

I didn't find a way to override the context of these subforms because the correct context, in this case, is an instance of IObject and we can't change this approach without changing the widget machinery entirely.

I think the better way to lookup a content from a subform in a MultiWidget is the solution proposed in plone.app.contenttree by Laurence Rowe.
See.: https://github.com/plone/plone.formwidget.contenttree/blob/master/plone/formwidget/contenttree/utils.py#L13

Then I've overridden the SubformAdapter for IObjectWidget and I've added colsest_content method in the new adapter.