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
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 \---------------------------------------------------/
participants (2)
-
Casey Duncan -
Jean Jordaan