Re: [Zope-dev] What would *you* like to have in PropertyManager and friends?
On Mon, May 28, 2001 at 09:37:21AM +0100, Chris Withers wrote:
Well, a nicer interface for changing them is about all I think they
need.
And sort the marshalling stuff out. It would be nice to actually store blank dates and numbers (None should be a valid value for both of them ;-) That's about all I can see that it needs (probably forgotten something though :-S)
Blank dates&numbers are important, I don' t know how they could escape us.
:-)
As for nicer interface... I guess you' ll have to elaborate a bit ;-)
Well, I think it's manage_changeProperties (nasty name for starters) that deletes any property you don't include in its arguments, see the interfaces wiki for details. How about just replacing it with: def modifyProperties(**kw) ...where kw is a dictionary mapping property name to property value. If it property specified in kw didn't exist, it would be created. Also, on addProperty and modifyProperties, how about making type coersion happen and raise an exception if it fails? so, if you did addProperty('test','string',1.234), addProperty would coerse 1.234 into the string '1.234' or raise an UncoercableException if it couldn't? Might be nice if the available property types were also documented somewhere. Hmm, also, coersion should check that when something is stored as the 'lines' property type, it only accepts a list of strings. cheers, Chris
[]s, |alo +---- -- I say a prayer now our love's departed That you'll come back to stay Bring back the perfect day
http://www.laranja.org/ mailto:lalo@laranja.org pgp key: http://www.laranja.org/pessoal/pgp
Brazil of Darkness (RPG) --- http://www.BroDar.org/
On Tue, 29 May 2001, Chris Withers wrote:
As for nicer interface... I guess you' ll have to elaborate a bit ;-)
Well, I think it's manage_changeProperties (nasty name for starters) that deletes any property you don't include in its arguments, see the interfaces wiki for details.
Nope, that's manage_editProperties, and it's just that the values get set to '', not that the property is deleted. manage_editProperties is suitable *only* to be called as the action of a web form that edits all the properties. Otherwise you want to use manage_changeProperties.
How about just replacing it with:
def modifyProperties(**kw)
...where kw is a dictionary mapping property name to property value. If it property specified in kw didn't exist, it would be created.
You can already pass manage_changeProperties a dictionary instead of REQUEST, and you can also pass it keyword arguments in addition or instead, which will cause the specified property values to get set. An interface for batch adding fields would be nice, but I would not want automatic property creation in the modify method. --RDM
participants (2)
-
Chris Withers -
R. David Murray