[Grok-dev] applyChanges and add forms
ct at gocept.com
Sat Apr 14 01:19:13 EDT 2007
Am Freitag, den 13.04.2007, 15:48 +0200 schrieb Martijn Faassen:
> This is nice in case of edit forms, but it blocks this usage of
> AddForms. Of course, in fact I lied in the above code. I claimed that
> MyContent implements the schema IMyContent but I do no such thing. I
> intuitively expected applyChanges help me make sure that this happened,
> but perhaps this is not the right pattern.
Right. It's clearly violating the contract.
> What can be do to make schema-driven content even simpler in Grok?
> Having to do a special __init__ and typing all the fields again seems a
> bother I'd like to avoid.
We could make some helper code that helps us satisfy the contract. E.g.
the add form's "apply changes" could initialize the schema (with it's
default values!??) before the normal `apply changes` code.
This is somewhat of a factory problem and I think we can argue away that
it shouldn't be the applyChanges method's problem to make the content
object fulfill its contract.
Hmm. OTOH this might make us end up in magic-hell because if the content
object decides to satisfy the contract, we shouldn't step on its toes.
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20070414/12d9c1bf/attachment.bin
More information about the Grok-dev