[Zope] ZClass Catalog Update

KJZZ Webmaster kjzz.webmaster at riomail.maricopa.edu
Sat Jan 24 14:04:32 EST 2004


> Date: Sun, 18 Jan 2004 00:12:58 +0100
> From: Dieter Maurer <dieter at handshake.de>
> Subject: Re: [Zope] ZClass Catalog Update

KJZZ Webmaster wrote:

> >I created the following DTML method in the "methods" folder of a ZClass:>
><dtml-call "Catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1)">
> ><dtml-call expr="RESPONSE.redirect(URL1)">
> ></dtml-let>
>
> >I then created an "update" tab which calls this method from the "views"
> >folder.
>>
> >2) What is the best way to deal with the permissions for this?

 Dieter Maurer wrote:

> A proxy role (read about them in the Zope Book, 2.6 edition).

Thank you for pointing this out.  If I go into the  DTML method I created in
the "methods" folder of my ZClass and change the Proxy Role to Manager, it
works just like it should!

> >1)  Is there a way to update only the individual ZClass object in the
> >catalog
>
> The method is "catalog_object" -- it, too, has a well chosen name ;-)

I have some questions about this, if the object is already in the catalog
and just needs to be updated.  Would I still use this method, or would this
create an additional object in the database?

I found the following python script which mentions how to use the
catalog_object method:

http://www.zopera.org/Members/Caro07/updatecatalog

request = context.REQUEST
catalog = context.Catalog

myobject = getattr (context, id)
catalog.catalog_object (myobject, id)

However, when I try using this, I receive an error saying that "global name
'id' is not defined"

Do you have any suggestions on how to I might implement this correctly?

Thanks!

John T.





More information about the Zope mailing list