[Zope3-Users] Re: z3c.multiform ItemAction does not supply action
handler with all the data - bugfix
Alek Kowalczyk
thealx at poczta.onet.pl
Thu May 17 12:39:33 EDT 2007
Alek Kowalczyk <thealx at ...> writes:
>
> I found that when submitting "Save" action (i.e exit from Input Mode),
> then in the FormBase.validate(self, action, data) function
> self.widgets contains:
> (a) "Input" versions of my widgets if the handler decorator is
> <at> parentAction
> (b) "Display" versions of my widgets if the handler decorator is
> <at> itemAction
> Because of that, in (b) case the FormBase.validate code (below) does not load
> data with the values supplied by user.
> return (getWidgetsData(self.widgets, self.prefix, data)
> + checkInvariants(self.form_fields, data))
>
> But still not sure if it is a bug, or I just use itemAction incorrectly.
>
> Regards!
> Alek.
>
I found where the bug is.
It is in MultiFormBase.checkInputModeAction in the line marked with three stars.
There is a missing '.' between item key and action name
def checkInputModeAction(self, action):
if interfaces.IItemAction.providedBy(action):
for key in self.forms:
*** name = self.prefix + '.sf.' + key + action.__name__
if name in self.request.form:
return action.inputMode
if interfaces.IParentAction.providedBy(action):
name = self.prefix + '.' + action.__name__
if name in self.request.form:
return action.inputMode
return None
The line should be changed to:
name = self.prefix + '.sf.' + key + '.' + action.__name__
More information about the Zope3-users
mailing list