[Zope] Re: Issue 1896: manage_changeProperties() vs
manage_addProperty()
Florent Guillaume
fg at nuxeo.com
Fri Jun 23 10:50:14 EDT 2006
Berthold Stöger wrote:
> Hello,
>
> in Issue #1896 (http://www.zope.org/Collectors/Zope/1896), I describe a
> difference in the behaviour of manage_changeProperties() and of
> manage_addProperty(): An array of ints is converted to an array of strings
> with manage_addProperty(), but not with manage_changeProperties().
>
> You closed the bug with the following comment:
>
>> Type converters only deal with the outer type but not with the types of
>> contained elements. This should be handled on the application level.
>
> Well, first of all this isn't true as my script shows (note: the report has a
> buggy test script, correct one attached): When using manage_addProperty(),
> the contents of the array *are* converted from integers to strings.
> Or maybe I'm reading you wrong?
>
> Furthermore, this still doesn't explain why the two functions behave
> differently. Digging a bit deeper, I found out that the culprit is in
> lib/python/OFS/PropertyManager.py:
>
> In manage_addProperty() the type_converter is always called, but
> in _updateProperty() the type_converter is only called if the value is a
> string. Similar code can be found in lib/python/OFS/PropertySheets.py
>
> Maybe there is some reason for this behaviour, but I can't think of one.
> Either of the following diffs (of course not both!) fixes the problem for me:
I've reopened the bug.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope
mailing list