[Zope] Adding properties to all objects of a certain type

Ausum augusto@artlover.com
Mon, 26 Feb 2001 14:56:48 -0500


Several weeks ago I did the same question without an answer.  What I found since
then is that if you are going to deal with documents whose properties are going
to grow and/or change, you must use regular Zclasses, or try to write your own
in Python. When you add a property to a Zclass you add it to all the documents
built with them.

I'd also like to have the kind of feature you talk about. Something like a tool
based on the manage_findResult method whose results have a checkbox, enabling to
perform several kind of processes over them, like adding, deleting or renaming
document's properties.  In the meantime this is the code to add properties using
dtml-call. Use it within a method at the same folder where your
to-change-objects are located.

<dtml-call "object.manage_addProperty('thepropertyname', 'the content string',
'type')">

where 'type' is the usual type you find at the edit properties page (string,
text, tokens, etc). Be aware that to execute the line you only have to make a
"view page" action one single time, and that you won't see any response after
its performance.

Ausum


----- Mensaje original -----
De: "Carl Blesius" <cblesius@ix.urz.uni-heidelberg.de>
Para: <zope@zope.org>
Enviado: Lunes, 26 de Febrero de 2001 12:55 p.m.
Asunto: [Zope] Adding properties to all objects of a certain type


> I want to add certain properties to objects of a certain type without
> having to use the web interface (there are too many of them)...
>
> e.g. I would like to add the following properties to all folders:
> title_en (string), nickname (string), nickname_en (string), template
> (string), reviewed (boolean)
> and the following to all DTML-Documents:
> lang (string), nickname (string), template (string), keywords (string),
> author (string), reviewed (boolean)
>
> A few documents and folders on the site have these properties already (is
> this a problem?).
>
> And after I add these properties to all documents and folders how do I get
> Zope to add them to new ones automatically?
> I want to keep everything as simple as possible... i.e. no Z Class to
> worry about when upgrading, etc.
>
> Concrete examples would be appreciated (theoretically I know it is
> possible with Zope considering what I have been able to do up to this
> point as a greenhorn!).
>
> Thanks,
>
> Carl.
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>