[Zope] CatalogAwareBase doesn't auto-reindex?

Laurie Nason laurien@blake.3dem.bioch.bcm.tmc.edu
Mon, 1 Oct 2001 08:57:53 -0500


Hi Bryan - sorry if you have this solved by now - but I didn't see any =
reply to the mail below.
What Chris is trying to say (I think) is that within the ZClass that you =
created, you need to create a dtml method that allows you to edit the =
properties of your ZClass.=20
Here's what I usually do:
---I copy the add form I use to add a new instance and paste it inside =
the ZClass object (in Products folder). (I tend to call mine =
index_edit_html).=20
---Inside this dtml method, I set the properties of the various text =
boxes, select lists etc to the values of the instance of the zclass.
---In the same place as where you copied the form you just created =
create another method (I call mine ZClassName_Update).
---Inside this method call the two functions that Chris mentioned=20
e.g.=20
    <dtml-call =
expr=3D"propertysheets.Basic.manage_changeProperties(REQUEST)">
    <dtml-call expr"reindex_object()">

hth,
Laurie

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Bryan =
Field-Elliot
Sent: Saturday, September 29, 2001 5:54 PM
To: chrism@zope.com
Cc: zope@zope.org
Subject: Re: [Zope] CatalogAwareBase doesn't auto-reindex?


OK Chris,

I understand what you're saying. But my follow-on question is, where =
exactly can I find the code that is auto-generated from the properties =
interface? And if there is no such code, then is there a complete code =
sample, somewhere, of how I would code this myself? Your statement:

You need to create a custom properties-editing form with a target that =
calls reindex_object as well as modifying the properties."=20

isn't really enough for a newbie like me to pick up and run with.

I'm also unclear where this prebuilt form is being built -- is it when I =
define the property sheet, or instead is it when I create a view out of =
a property sheet?

Having fun getting to know this system!

Bryan



On Sat, 2001-09-29 at 16:14, Chris McDonough wrote:=20
Hi Bryan,

Please keep the mail on the maillist, thanks.

This is a limitation when using prebuilt forms from the properties=20
interface.  The prebuilt propertysheet editing forms don't call=20
reindex_object.

You need to create a custom properties-editing form with a target that=20
calls reindex_object as well as modifying the properties.

You could make the target a Python Script or a DTML method, as long as=20
it calls the right stuff (manage_changeProperties and reindex_object) on =

itself with the right values.

HTH!

- C


Bryan Field-Elliot wrote:
> Thanks,
>=20
> Where do I place this call? There are no methods to modify, except the =

> constructor. The constructor isn't the appropriate place, I think.
>=20
> Thanks,
>=20
> Bryan
>=20
> On Sat, 2001-09-29 at 16:04, Chris McDonough wrote:
>=20
> /I think you need to call "reindex_object" on your catalogaware object =
/
> /manually... it indexes itself automatically but doesnt reindex itself =
/
> /automatically./
> //
> /See http://www.zope.org/Members/AlexR/CatalogAware for more info.../
> //
> /Bryan Field-Elliot wrote:/
> /> Hi,/
> /> /
> /> I'm new to Zope -- let me first say, I'm totally blown away! I come =
from /
> /> a Java/JSP/Servlet world, and Zope is just blowing my mind!/
> /> /
> /> I am using the latest Zope release (downloaded and installed =
yesterday)./
> /> /
> /> I am trying to use ZCatalog, and CatalogAwareBase as a base class =
for my /
> /> custom ZObject./
> /> /
> /> I have successfully managed to get things straight so that my =
catalog /
> /> notices whenever I create new instances of my custom classess (I =
had to /
> /> call my catalog "Catalog"). The new instances correctly show up in =
the /
> /> "Catalog" tab of my Catalog./
> /> /
> /> However, I am having a terrible time trying to get the Catalog to /
> /> automatically re-index objects when I modify them. I am using =
standard /
> /> property sheet editor page generated in the Product config area for =
my /
> /> object class. Is this the wrong thing to do?/
> /> /
> /> It's hard to imagine the usefulness of the ZCatalog without it =
being /
> /> up-to-date when objects change. I guess I'm just used to the RDBMS =
world /
> /> where this is completely expected behavior./
> /> /
> /> I can't tell if this is a bug in CatalogAwareBase, or else if the /
> /> documentation is lacking./
> /> /
> /> Thanks,/
> /> /
> /> Bryan/
> /> /
> /> /
> //
> //
> /-- /
> /Chris McDonough                    Zope Corporation/
> /http://www.zope.org             http://www.zope.com/
> /"Killing hundreds of birds with thousands of stones"/
> //
>=20


--=20
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"


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