[Zope-dev] basci properties

Robin Becker robin@jessikat.fsnet.co.uk
Mon, 9 Oct 2000 16:06:02 +0100


In message <39E1D777.6B114FEC@kaivo.com>, Paul Erickson <erickson@kaivo.com> writes

Well I was trying to get a self contained class initialisation using a bit of python

I had defined a propertsheet called ClassConstants containing a tokens property with
"A B C" in my extern method initialiser I was doing 

    self = self.this()
    obj = self.ZC.createInObjectManager(id, REQUEST)
    obj.manage_addProperty('t','tokenList','multiple selection')

in the add form I could not seem to get access to the property tokenList
 ie
 I wasn't getting nice things from either
 <dtml-with "_.namespace(S=tokenList)">

not seeing the property.

or 

 <dtml-with "_.namespace(S=Control_Panel.Products.myProduct.ZC.propertysheets.common
.ClassConstants.getProperty('tokenList')>

failing with a permissions problem

in the end I had to define a product external method called getTokenList
which did
def getQProjectList(self):
        obj = self.unrestrictedTraverse("Control_Panel/Products/myProduct/ZC/propert
ysheets/common/ClassConstants")
        return obj.getProperty('tokenList')

How does one define properties which are visible at construction time?


>Just create a ZClass that inherits from ObjectManager, then you will
>have to use the Subobjects tab to tell it what kind of objects it can
>contain.
>
>For properties, click on the Property Sheets tab and add one (be sure
>you're in the class, not the product). Put whatever properties on it
>that you like. Remember that properties won't get set in the constructor
>unless you uncomment the 
>
><dtml-call "propertysheets.Basic.manage_editProperties(
>                  REQUEST)">
>line in the constructor.  (change "Basic" if that's not what you called
>your property sheet.
>
>Robin Becker wrote:
>> 
>> I want to create a ZClass that is essentially a folder with some added
>> properties. I can see no way to add to the Basic properties of my
>> ZClass.
>> 
>> Is there a way to do that?
>> --
>> Robin Becker
>> 
>> _______________________________________________
>> Zope-Dev maillist  -  Zope-Dev@zope.org
>> http://lists.zope.org/mailman/listinfo/zope-dev
>> **  No cross posts or HTML encoding!  **
>> (Related lists -
>>  http://lists.zope.org/mailman/listinfo/zope-announce
>>  http://lists.zope.org/mailman/listinfo/zope )
-- 
Robin Becker