Thomas Guettler wrote:
* Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module Products.OOPServer.Demo.Demo, line 200, in deleteAllObjects * Module OFS.ObjectManager, line 448, in manage_delObjects
TypeError: object doesn't support item deletion
My object is inherited from the following classes: SimpleItem, Persistent, Implicit, CatalogAware
The container is a BTreeFolder2.
objectIds() does not return a list, but: <OOBTreeItems object at 0x93b1a68>
BTW, the problem is not important, because my code works. I am just looking for cleaner solution.
thomas
My mistake, I was looking at BTreeFolder1 at that time. I was sure that would work to. Arguably this is either a bug in ObjectManager or in BTreeFolder2 , since BTreeFolder2 doesn't return something that ObjectManagers manage_delObjects recognizes as sequence type. Since manage_delObjects wants to be smart, it also accepts single strings (in contrast to a sequence with a single object) as an argument. This causes it to try to delete an object of type "OOBTreeItems", which is what objectIds returns for BTreeFolder2 objects. This causes the error you see. To make a long story short, self.manage_delObjects(list(self.objectIds())) works, tuple() should work, too. cheers, oliver