How to delete an object given a path in Zope
Hi guys, I am trying to figure out how to delete an object in Zope given a path. Using restrictedTraverse I'm able to get the object by its path. I then want to delete this object. I'm assigning the result to 'obj' as shown here: obj = context.restrictedTraverse('webcasts/courses/temp') The goal here is to be able to delete 'temp' by giving it a path. Any help is greatly appreciated. Thanks, Mike
Takahashi, Michael wrote:
I am trying to figure out how to delete an object in Zope given a path.
<snip>
Any help is greatly appreciated.
You want to call manage_delObjects on the parent folder and give it the list of ids.
Takahashi, Michael wrote at 2006-3-14 12:25 -0800:
... Using restrictedTraverse I'm able to get the object by its path. I then want to delete this object.
When you have an object "obj" inside the site hierarchy, then "obj.aq_inner.aq_parent" is its container (in this hierarcy). Therefore, an idiom to delete "obj" is: obj.aq_inner.aq_parent.manage_delObjects(obj.getId()) -- Dieter
participants (3)
-
Dieter Maurer -
suresh -
Takahashi, Michael