[Zope-CMF] Product properties: set and get ?

D2 borelan@wanadoo.fr
Mon, 12 May 2003 12:52:42 -0400

Chris Withers a écrit:
> D2 wrote:
>> I tried this :
>> def add_ClassProperty(product, klass, property, value):
>>     """Change a class properties
>>        The class must have PropertyManager in its hierarchy
>>     """
>>     exec 'from %s import %s' % (product, klass)
>>     exec 'setattr(%s, property, value)' % (klass)
>>     exec '%s._properties=%s._properties+({\'id\':property, 
>> \'type\':\'string\'},)' % (klass, klass)
>> add_ClassProperty('OFS.Folder', \
>>                   'Folder', 'New_property', 'New Value')
> Aaagggh! What ARE you doing?

Oops, it seems painful. Sorry.
But why is it so painful ?

> More to the point, why are you doing it?

First, to reply to Jean-Francois,
Next, i have a project where there's a base class user can copy and 
modify to have it suit their needs. Something to generate basic 
applications via a form because the users won't be involved in the 
development process.
I can use it as a mean to accelerate the development process. I'll be 
able, via a form, to describe classes and forms during an interview with 
a user for example.
I didn't really think about it.
The more i am discovering Zope, the more i try various things to go 
deeper and deeper. Each error is a way to learn.

Your "Aaagggh!" is so impressive :)
What rule am i breaking doing that ?
What's the difference between doint it that way and doing it via the 
property sheets of a Zclass ?


> And, more usefully, what are you actually trying to achieve here?
> cheers,
> Chris
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> See http://collector.zope.org/CMF for bug reports and feature requests