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   [EMAIL PROTECTED]
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to