CatalogPathAwareness and manage_beforeDelete
hello all i have a product that subclass CatalogPathAwareness and SimpleItem all works ok. i,e an object instance will be added and deleted from the catalog however, if i override manage_beforeDelete, the catalog is not cleared when i delete the object instance is that natural? do i have to supply my own uncatalog_object ? with this snippet, it still doesnt work. i guess i don't get what uid for uncatalog_object is ... here's the snippet def manage_beforeDelete(self, item, container): """method for delete /cut/paste/rename""" img_dir = getattr(self.aq_parent, 'images') img_dir.manage_delObjects([item.getId()+'_image']) self.uncatalog_object(item.absolute_url(1)) thanks -- http://www.kedai.com.my/ http://www.kedai.com.my/eZine http://www.zope.org/Members/kedai http://www.my-zope.org Am I Evil?
Bakhtiar A Hamid wrote:
hello all i have a product that subclass CatalogPathAwareness and SimpleItem all works ok. i,e an object instance will be added and deleted from the catalog
however, if i override manage_beforeDelete, the catalog is not cleared when i delete the object instance
is that natural? do i have to supply my own uncatalog_object ?
with this snippet, it still doesnt work. i guess i don't get what uid for uncatalog_object is ...
here's the snippet
def manage_beforeDelete(self, item, container): """method for delete /cut/paste/rename""" img_dir = getattr(self.aq_parent, 'images') img_dir.manage_delObjects([item.getId()+'_image']) self.uncatalog_object(item.absolute_url(1))
Hi, just a guess: Maybe you should unindex your object first and then delete it... and another one: please try unindex_object instead of uncatalog_object: def manage_beforeDelete(self, item, container): """method for delete /cut/paste/rename""" img_dir = getattr(self.aq_parent, 'images') self.unindex_object() img_dir.manage_delObjects([item.getId()+'_image']) -mj
Bakhtiar A Hamid writes:
hello all i have a product that subclass CatalogPathAwareness and SimpleItem all works ok. i,e an object instance will be added and deleted from the catalog
however, if i override manage_beforeDelete, the catalog is not cleared when i delete the object instance
is that natural? Yes, as cataloging uses the hooks provided by "manage_afterAdd" and "manage_beforeDelete".
do i have to supply my own uncatalog_object ? No.
But you probably should call the overridden "manage_beforeDelete".
with this snippet, it still doesnt work. i guess i don't get what uid for uncatalog_object is ...
here's the snippet
def manage_beforeDelete(self, item, container): """method for delete /cut/paste/rename""" img_dir = getattr(self.aq_parent, 'images') img_dir.manage_delObjects([item.getId()+'_image']) self.uncatalog_object(item.absolute_url(1)) Try: def manage_beforeDelete(self, item, container): """method for delete /cut/paste/rename""" <YourClass>.inheritedAttribute('manage_beforeDelete')(self,item,container) img_dir = getattr(self.aq_parent, 'images') img_dir.manage_delObjects([item.getId()+'_image'])
You must (of course) replace "<YourClass>" with the name of your class. Dieter
participants (3)
-
Bakhtiar A Hamid -
Dieter Maurer -
Maik Jablonski