[Grok-dev] Where can I ask questions about zeam.form.ztk?
Sylvain Viollon
sylvain at infrae.com
Tue Nov 9 10:18:49 EST 2010
On Tue, 9 Nov 2010 16:00:25 +0100
Sebastian Ware <sebastian at urbantalk.se> wrote:
> Hi Sylvain!
>
Hello,
> I am looking at zeam.form.ztk. It looks really promising, but I have
> some questions. Can I post them here on grok-dev?
>
I think it is ok, unless someone objects. Probably if those are quick
questions, IRC will be faster, #grok on irc.freenode.net.
> The first one is why you do
>
> content.set(field.identifier, value)
>
> and not
>
> setattr(content, field.identifier, value)
>
> when you update attributes on an object in the applyData method of
> EditAction (actions.py:23):
>
> def applyData(self, form, content, data):
> for field in form.fields:
> value = data.get(field.identifier, _marker)
> if value is NO_VALUE and not field.required:
> value = data.getDefault(field, _marker)
> if value is not _marker:
> content.set(field.identifier, value)
>
Content is not the form content. It is something called dataManager
[1] which uniforms the access to content used by the form (that can
be an object, a dictionary, an adapted object ...).
Regards,
Sylvain,
[1]:
https://github.com/thefunny42/Zeam-Form/blob/master/src/zeam/form/base/datamanager.py
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
More information about the Grok-dev
mailing list