[Zope] Recataloging object instances

Casey Duncan c.duncan@nlada.org
Tue, 13 Nov 2001 13:55:07 -0500


On Tuesday 13 November 2001 04:45 am, Jean Jordaan allegedly wrote:
> Hi all
>
> In the 'handlemail' method that is called for incoming mails,
> I have roughly the following code::
>
>  apply( mail_folder.manage_addProduct['ZMailIn'].manage_addZMailMessage
>       , new_mail_args
>       , {}
>       )
>
>  zmail.manage_addProperty('status', 'unassigned', 'lines')
>
> ZMailIn subclasses CatalogAware, so the new instance gets cataloged.
> However, the 'status' property that I add after creation does *not*
> get cataloged. (It does get cataloged when I manually update the
> catalog.)
>
> In order to get the 'status' property cataloged, I added the following
> two lines::
>
>  ZMailInCatalog.uncatalog_object('/' + zmail.absolute_url(1))
>  ZMailInCatalog.catalog_object(zmail, '/' + zmail.absolute_url(1))
>

If this puppy is CatalogAware, you don't need to use this code. You can do 
this much more efficiently by using:

zmail.index_object()

Use this instead of "reindex_object" it is much more efficient and only 
updates the indexes for the attributes that were changed.

hth,
/---------------------------------------------------\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  c.duncan@nlada.org
\---------------------------------------------------/