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.
The adapter lookup for the default value adapter in
dexterity.py:95
uses the wrong discriminators. It should be(context, request, view, field, widget)
(seeplone.directives.form.value.py:32
), but instead the lookup currently usesself.container
as thecontext
, 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
andget_default_value_for_field
methods.In order to do that, the call to
insert_field_default_values
had to be moved down after thecreateContentInContainer
call. This means the default values won't be passed in**self.arguments
tocreateContentInContainer
any more, but instead be set later in theset_field_values()
call./cc @jone @maethu @phgross