[Zope] Class variables in ZClasses

Darran Edmundson Darran.Edmundson@anu.edu.au
Fri, 03 Dec 1999 16:11:39 +1100


Jim, pardon my denseness but I'm still struggling with this.
It seems like your response contains conflicting ideas.

> You simply have to arrange to get SubjectChoices to be an
> attribute of the class managed by the ZClasses.  

>   import Zope
>   app=Zope.app()
>   app.Control_Panel.yourProduct.yourZClass.setClassAttr(
>      'SubjectChoices',{...})
>   get_transaction().commit()
>   app._p_jar.close()

I understand the sentence above and the code snippet to
mean the same.  Namely, that *if* MyProduct.MyZClass had
a properties tag, I could simply use this to add a new 
property which all instances of MyZClass would acquire.
ZClasses don't have property forms and so I use the python
code to add the desired attribute.  However, ...


> If there
> was a way to create dictionary properties, you could do this
> via a propertysheet, since ZClass propertysheets create
> default property values in classes.  Since Zope doesn't
> give you a way to spell this through the web, you have to resort
> to Python.  

If I add a ClassVariables propertysheet to MyZClass, won't this
get instantiated every time I create a new MyZClass instance?

It seems to me that "class variables" cannot be added to a ZClass
via the web interface, not just for dictionaries (since this isn't
a recognized Zope property type), but for all property types.

Cheers,
Darran.

-- 
Darran Edmundson [Darran.Edmundson@anu.edu.au]