4teamwork/ftw.builder — pull request #26 by lukasgraf (2014-06-23 13:35:20+00:00)
Title: DxBuilder: Fix discriminators for default value adapter lookup.

The adapter lookup for the default value adapter in [`dexterity.py:95`](https://github.com/4teamwork/ftw.builder/blob/5fabb899d8a4c60402994a69f27abb5e35a690a4/ftw/builder/dexterity.py#L95) uses the wrong
discriminators. It should be `(context, request, view, field, widget)`
(see [`plone.directives.form.value.py:32`](https://github.com/plone/plone.directives.form/blob/master/plone/directives/form/value.py#L32)), 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