Hey, DTML came first in The Fine Manual. I'll work on ZPT when the workload cools off a bit. ;-) Re: Python vs DTML method. I started out with all that "Do you really, really, really, truly want to delete such and so? Interface and just stuck with the DTML method when I tossed it out to simplify the problem. All this stuff is currently embedded in a tree method. "Here" is the top level and the object that's getting deleted is one of the leaves. Tree-item-url gives me all the info I need but manage_delObjects apparently wants to see only the id of the item to be deleted without any path info. And all the path info needs to be glued on the front to make mypath.myfolder.manage_delObjects. Looks like I'll spend tonight reading up on restricted traverse. Thanks for the tips. -----Original Message----- From: Lennart Regebro [mailto:regebro@nuxeo.com] Sent: Wednesday, March 24, 2004 4:34 PM To: Horak, Karl; zope@zope.org Subject: Re: [Zope] Programmatically deleting objects From: "Horak, Karl" <KEHORAK@sandia.gov>
<A HREF="goDelete?item=<dtml-var id>&delPath=<dtml-var expr="aq_parent.aq_parent.id">.<dtml-var expr="aq_parent.id">">
<dtml-call expr="REQUEST.delPath.manage_delObjects([REQUEST.item])"> (This generates an AttributeError stating 'str' object has no attribute 'manage_delObjects')
Yes, delPath is a request variable, and therefore a string. It seems to me that you want to delete the item that you are viewing, there "here" object, so to speak. All the information you need to identify which object that is, is the path. You can probably pass <dtml-var absolute_url> as the item. That should be enough. Possibly you need "absolute_url(relative=1)", I'm not sure.
<dtml-call expr="_.getitem(REQUEST.delPath).manage_delObjects([REQUEST.item])">
I don't seem why you call an DTML method to run python code. Use a python script instead. In the pythonscript youshould be able to use restricted traverse to find the object item, get it's aq_parent, and call manage_delObjects on it. However, even this is total overkill. :-) <A HREF="<dtml-var expr="aq_parent.absolute_url()+'myDeleteScript?item='+id">"> should give you a link pointing to http://foo.com/the/parent/object/myDeleteScript?item=objectid The myDeleteScript then simply calls context.manage_delObjects(item) That should do it. Do you really want to use DTML?