hi Dieter,

thanks for the advice. i have written a small DTML script which i plan to
call from the standard html header so that the intranet users will
unknowingly populate the docs as they browse. saves me from doing it
manually unless there are file objects in the folder. here is the script:

<dtml-in "PARENTS[0].objectItems(['File','DTML Document'])" sort=title>
<dtml-unless "_.string.find(_['id'],'index_html')==0">

properties are added in the unless below.
to add additional properties to this script repeat the unless block
for each new property and change the id and type to what you
want to add.

<dtml-unless "hasProperty('rev')">
<dtml-call "manage_addProperty('rev','none','string')">


to run the script give it manager role and call the method in the URL or
with a <dtml-var> tag. you can select the types of objects it "sees" in the
first line. please let me know if there is some flaw in doing it this way.

take care


ps: i tried to make a python method for this but couldn't figure out how to
handle the objects properly.

-----Original Message-----
From: Dieter Maurer [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 05, 2000 12:49 PM
To: michael angelo ruberto
Subject: Re: [Zope] adding properties to all existing docs

michael angelo ruberto writes:
 > i have a Zope containing 4700+ files and documents. i want to add new
 > properties to all of them, how can i do this programmatically? is it
 > possible to change the base classes? if so, how?
It is possible to change the base class but I would not do it
(as it affects all Zope objects and your change is likely
to disappear when you upgrade).

You can automate Zope either internally or externally.

  Internally (via a method (DTML or Python)) you would
  use ZopeFind to list all objects that need to be
  updated and then iterate (dtml-in) over the objects
  to update.

  Externally, you would use "ZPublisher.ZClient".

I would go for the internal solution.


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to