[Zope] Add a property with a class constructor

Hervé Richard richard@avignon.inra.fr
Fri, 13 Apr 2001 17:20:22 +0200


Hi,

Please, look at my problem :
I create a new zclass NEWCLASS with one common property named "NbItem",
The zclass constructor can put (with the form) this property value when i 
create  a NEWCLASS object, but i also want to create new properties in each 
NEWCLASS objects (in fact i want to create "NbItem" new properties). That is 
my problem, i don't know how to do ?

In a foder i can write a dtml-method like this, but from the constructor ?
 
<HTML> 
  <BODY> 
    <dtml-with "PARENTS[0]">
      <dtml-let NbItem="getProperty('NbItem')">
      <dtml-in expr="_.range(1,NbItem+1,1)">    
	  <dtml-var sequence-item>
	<dtml-let NewProp="_.string.join(['Item_',
                                      _.str(_.getitem('sequence-item'))],
                                         '')">
	     <dtml-call expr="manage_addProperty(NewProp,'','string')">
	  </dtml-let>
	</dtml-in> 
      </dtml-let>  
    </dtml-with>
  </body>
</html>

Thanks for your help !

-- 

    Herve RICHARD
   INRA - Biometrie			tel: 04 32 72 21 79
       AgroParc      			Prof. email: Herve.Richard@avignon.inra.fr
 84914 AVIGNON cedex 9 - FRANCE		Priv. email: rv.richard@oreka.com