[Zope] zcatalog/zclass problem.. help!

Kevin Dangoor kid@kendermedia.com
Thu, 23 Sep 1999 15:05:26 -0400


-----Original Message-----
From: Chris McDonough <chris@iqgroup.com>
To: 'zope@zope.org' <zope@zope.org>
Date: Thursday, September 23, 1999 1:40 PM
Subject: [Zope] zcatalog/zclass problem.. help!


>It's based on ZObject and ZClass_for_Catalog_Aware.
>ZClass_for_Catalog_Aware was the first base class when it was created.

>Now this sort of works... this dtml snippet will display just "news:" when
a
>new instance of the News Item zclass is added to the site, meaning that it
>KNOWS there's a new instance of News Item....  for each news item that gets
>added, it will display another instance of the text "news:".  So on my
front
>page, if I have five news items zclass instances in my site, it'll look
>something like this:

>However, it wont display any of the dynamic content eg. <!--#var
>department-->, <!--#var subject-->, etc. until I go into the Catalog
>Zcatalog and manually update the catalog.  Once I manually update the
>zcatalog, I get content like:
>
>AppDev news:
>This is news.

[lots of snipping above]

A CatalogAware ZClass will automatically add and remove itself from the
catalog. However, it does not update the catalog when properties are
changed. This includes in the ZClass_add method... You need to:

1) add the line "<dtml-call reindex_object>" after you call
"propertysheets.properties.manage_changeProperties..."

2) If you want to be able to edit these, create a form that essentially
duplicates the propertysheet form and post the results to a dtml method like
this:
<html><body>
<dtml-call "propertysheets.properties.manage_changeProperties(REQUEST)">
<dtml-call reindex_object>
<p>Changes saved.</p>
</body></html>

Kevin