[Zope] manage_beforeDelete

Paul Winkler pw_lists at slinkp.com
Mon Oct 9 11:31:50 EDT 2006


On Fri, Jul 02, 2004 at 07:40:31PM +0200, Garito wrote:
> Hi all!
> 
> I have a class like these:
> 
> class Test(CatalogAware, , OrderedFolder):
>     def manage_beforeDelete(self, item, container):
>         CatalogAware.manage_beforeDelete(item, container)
>         OrderedFolder.manage_beforeDelete(item, container)
> 
> I only put the relevant code
> 
> If I delete de hook to manage_beforeDelete the class works fine (the objects
> disappear from the catalog) but if I put the function the catalog don't
> delete the objects
> 
> any idea?

In Python, anytime you call "unbound" methods (i.e. by referencing
a class rather than an instance), you need to pass an instance -
in this case, self - explicitly.

For example:

    def manage_beforeDelete(self, item, container):
        CatalogAware.manage_beforeDelete(self, item, container)
        OrderedFolder.manage_beforeDelete(self, item, container)


But if your actual code looks like your example, you should have
gotten errors due to missing arguments.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list