[Checkins] z3c.form/trunk/src/z3c/form/form.py Improve change test

Michael Howitz mh at gocept.com
Mon Jul 12 11:51:54 EDT 2010


Am 10.05.2010 um 17:19 schrieb Wichert Akkerman:
> Log message for revision 112227:
>  Improve change test
> 
> Changed:
>  U   z3c.form/trunk/src/z3c/form/form.py
> 
> -=-
> Modified: z3c.form/trunk/src/z3c/form/form.py
> ===================================================================
> --- z3c.form/trunk/src/z3c/form/form.py	2010-05-10 15:11:04 UTC (rev 112226)
> +++ z3c.form/trunk/src/z3c/form/form.py	2010-05-10 15:19:00 UTC (rev 112227)
> @@ -44,9 +44,11 @@
>         dm = zope.component.getMultiAdapter(
>             (content, field.field), interfaces.IDataManager)
>         # Only update the data, if it is different
> +        # Or we can not get the original value, in which case we can not check
>         # Or it is an Object, in case we'll never know
> -        if ((dm.canAccess() and dm.get() != data[name])
> -            or zope.schema.interfaces.IObject.providedBy(field.field)):
> +        if (not dm.canAccess() or 
> +            dm.get() != data[name] or 
> +            zope.schema.interfaces.IObject.providedBy(field.field)):
>             dm.set(data[name])
>             # Record the change using information required later
>             changes.setdefault(dm.field.interface, []).append(name)

Hi Wichert,

could you please add a test for this change?
I think it is wrong: When dm.canAccess() returns False, dm.set is called immediately. (Or am I wrong?)
What's the use-case for this? Why should a value get set when it cannot be accessed?


Yours sincerely,
-- 
Michael Howitz · mh at gocept.com · software developer
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development



More information about the checkins mailing list