[Zope] Recataloging object instances

Jean Jordaan jean@upfrontsystems.co.za
Tue, 13 Nov 2001 11:45:00 +0200


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))

My question is this: why do I have to add the leading slash, here?
'manage_addZMailMessage' catalogs the instance as '/mail_folder/zmailNNN', 
and 'absolute_url(1)' returns 'mail_folder/zmailNNN' (without the leading 
slash). 

Another question: shouldn't the added property automatically get
cataloged, without 'uncatalog_object'/'catalog_object' being called 
explicitly?

I'm on Zope 2.3.2 on Linux .. 

Regards, 
Jean Jordaan