[Grok-dev] Re: applyChanges and add forms
Philipp von Weitershausen
philipp at weitershausen.de
Mon Apr 16 10:11:14 EDT 2007
On 16 Apr 2007, at 15:00 , Martijn Faassen wrote:
> On 4/15/07, Philipp von Weitershausen <philipp at weitershausen.de>
> wrote:
> [snip]
>> I agree. I'd say we want to enhance Zope's applyChanges to not expect
>> the field value on the object. At least that's the most straight-
>> forward
>> thing I can think of -- and it would go along with what I expect from
>> applyChanges.
>>
>
> For edit forms applyChanges does the correct thing. It checks whether
> the values really have changed, and if not, then no database
> transaction needs to be triggered so the values aren't set in the
> first place.
Yup.
> For add forms this doesn't work. We could either overload grok's
> applyChanges so it just stores stuff for add forms, or we could
> consider another method to do the equivalent. The method is after all
> called apply*Changes*, and we're not applying changes. We're applying
> it for the first time.
Right. Perhaps applyChanges should be
* amended to support the add form use cases
* and renamed to applyData or something similar
One could argue that we should have two methods, applyChanges (only
applies changes) and applyData (always applies all data, no
checking), but I'm inclined to say that this is a choice the novice
Grok developer won't necessarily care about. If we make applyChanges
do the right thing on even when the attributes aren't there, I think
everybody would be happy. But perhaps I'm missing something.
More information about the Grok-dev
mailing list