Hi Andreas,

Thank you very mch for your help, your method works very well.
However, it fails to rename the zsql methods. The objective here is
to get rid of the transparent folder, but there are many sql methods
inside several transparent folders. The idea here is to give the path of transparent folders as the the title to the zsql method , place them in the root, and then move them to subfolders. I try another python script to rename only the zsql methods. Its not working even when i hardcode foldername ad title in the pythonscript and call it in
a dtml method.

Please take a look at the code below

def zsql_set_title(self, folder_path, title):

  objs = self.ZopeFind(folder_path,
                obj_metatypes=['Z SQL Method'],

  for  method in objs:

     title = title
     conn_id = method.connection_id
     args = method.arguments_src
     body = method.src
     method.manage_edit(title, conn_id, args, body)

Could you please spot the mistakes here?


From: Andreas Jung <[EMAIL PROTECTED]>
Reply-To: Andreas Jung <[EMAIL PROTECTED]>
To: siva k <[EMAIL PROTECTED]>, zope@zope.org
Subject: Re: [Zope] setting a title to all objects in a folder?
Date: Wed, 27 Dec 2006 18:43:42 +0100

Hash: SHA1

- --On 27. Dezember 2006 17:38:21 +0000 siva k <[EMAIL PROTECTED]>

> Hello,
> Absolute newbie to python here. I try to set the SAME title to ALL the
> files in a
> zope folder using a python script.  The code below is not working... no
> idea why

> def setfiletitle(folder,title):
>     myfolder = getFolder(folder)
>     for file in myfolder:
>             setTitle(title)

Why should it work?

Do you think that code works just because you
write some methods without knowing about APIs and the frameworks

To get hold of an object by path: use restrictedTraverse()
To get hold of objects with a folder: folder.objectValues(9
To change a property of an object: someobject.manage_changeProperties()



def foo(self, folder_path, title):

  folder = self.restrictedTraverse(folder_path):
  for o in folder.objectValues():
     o.manage_changeProperties({'tite' : title})

- -aj
Version: GnuPG v1.4.6 (Darwin)


Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to