RE: [Zope] FW: [Zope] adding properties to all existing docs

2000-11-09 Thread michael angelo ruberto


However, I would not make such changes asynchronously.
I would use "ZopeFind" to locate all objects that need to
be updated and then do it.
Maybe, its a matter of personal taste ...


Dieter

this is an interesting idea. another thing i might try is running the script
from Xron and ZopeFinding the objects. in this way the task is completely
automated and will free me from having to run it whenever new objects are
added.

-mike-


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] FW: [Zope] adding properties to all existing docs

2000-11-08 Thread michael angelo ruberto



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"

dtml-comment
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-comment

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


/dtml-unless
/dtml-in

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

-mike-

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
Cc: [EMAIL PROTECTED]
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.


Dieter


___
Zope maillist  -  [EMAIL PROTECTED]
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 )