4teamwork / ftw.builder

Builder pattern for creating Plone objects in tests
3 stars 0 forks source link

DxBuilder: Fix discriminators for default value adapter lookup. #26

Closed lukasgraf closed 10 years ago

lukasgraf commented 10 years ago

The adapter lookup for the default value adapter in dexterity.py:95 uses the wrong discriminators. It should be (context, request, view, field, widget) (see plone.directives.form.value.py:32), but instead the lookup currently uses self.container as the context, which causes default value adapters that use the context as a discriminator to be skipped.

This PR fixes this by supplying the newly created object to the insert_field_default_values and get_default_value_for_field methods.

In order to do that, the call to insert_field_default_values had to be moved down after the createContentInContainer call. This means the default values won't be passed in **self.arguments to createContentInContainer any more, but instead be set later in the set_field_values() call.

/cc @jone @maethu @phgross

maethu commented 10 years ago

:+1: