[Zope] Deleting an object from ZCatalog search results

Dieter Maurer dieter@handshake.de
Mon, 4 Feb 2002 23:29:00 +0100


Nuno Maltez writes:
 > What do you consider to be the easiest way to delete an object "returned"
 > in a ZCatalog search. I can get the object by using getObject on
 > the data_record_id_, but how can I delete it?
 > 
 > Do I need to do some sort of traversal to the folder that contains the
 > object?
 > 
 > Is there a method for an object to delete itself? Something like
 > 
 > <dtml-call "object.self_destruct()">
Now, the method is not on the object but on the container and
is called "manage_delObjects". It takes a sequence (!) or
ids and deletes the specified subobjects.

Thus, you problem is how to get at the container, given the object.

  Depending on how "getObject" wraps the returned object
  "getObject(...).aq_parent" may work.

  If it does not work, you need to use

     "getObject(...).aq_inner.aq_parent
     
  "aq_inner" is not exposed to DTML/Python Scripts (a bug in my view).
  Thus, you need an External Method or something similar.


Dieter