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.
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 )
I would create a DTML method that wraps the manage_addProperty method like this and view it by pressing the 'view' tab (tested): <dtml-in "objectValues(['Folder'])"> <dtml-unless reviewed> <dtml-call "manage_addProperty('reviewed',1,'boolean')"> </dtml-unless> </dtml-in> You should expand this to meet your specific needs. Of course the proper way to do things such as this is by means of a Python script, but to my disgrace I'm still a lot more familiar with DTML than with Python hth Cornelis J. de Brabander ========================================== Department of Education, Leiden University P.O.Box 9555, NL-2300 RB Leiden +31 71 527 3422/3401 brabander@fsw.leidenuniv.nl ==========================================
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Carl Blesius Sent: maandag 26 februari 2001 18:55 To: zope@zope.org Subject: [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 )
participants (3)
-
Ausum -
Carl Blesius -
Cornelis J. de Brabander