[Zope] Re: manage_beforeDelete
Tres Seaver
tseaver at palladion.com
Mon Oct 9 12:10:42 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Paul Winkler wrote:
> 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.
Except that 'OFS.ObjectManager' logs and suppresses any non-vetoing
errors raised by an object's 'manage_beforeDelete': the tradeoff is
that buggy objects could otherwise be unremovable.
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFKnSC+gerLs4ltQ4RAocMAKC6VAVQfuXdOD1Zw8f+lewf/24T+ACeKmja
aqXoiqnWJxuXzqJ9ZEXXw1k=
=mgqJ
-----END PGP SIGNATURE-----
More information about the Zope
mailing list