[Zope-dev] Anyone know how to add a property to a Zope Product (not its instances)?

Casey Duncan c.duncan@nlada.org
Mon, 22 Oct 2001 09:17:53 -0400


On Saturday 20 October 2001 05:41 pm, Joachim Werner allegedly wrote:
> > By default, Zope adds the title and version properties, for which it
> > gets the value from version.txt and meta_type,
> > but does anyone know a way to add more?
>
> This is only half an answer, but maybe it helps:
>
> I am not quite sure if you can do that the easy way from Python. (I.e. just
> define a _properties list). But you certainly can use manage_addProperty:
>
> self.Control_Panel.Products.YOURPRODUCT.manage_addProperty(id="TEST",
> value="TEST ENTRY", type="string")
>
> The question is where to put this, probably somewhere in the __init__.py? I
> don't know if you CAN call it from there. It definitely works from the
> contructor method of your product, but then the new property will only show
> up after the first instance has been added ...
>
> Joachim

AFAIK Zope doesn't officially support meta-data associated with a product in 
any meaningful way.

I have often thought this would be beneficial tho, as it would allow a 
product to have a global configuration interface in the ZMI that would affect 
all instances.

I think it would be a worthwhile project to think about an API for product 
"preferences". Perhaps this could be added (as tabs I guess) to the exisitng 
Zope preferences.

/---------------------------------------------------\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  c.duncan@nlada.org
\---------------------------------------------------/