[Zope] Some objects cannot be deleted programmatically?

Dieter Maurer dieter@handshake.de
Fri, 4 Jul 2003 22:30:12 +0200


Jaroslav Lukesh wrote at 2003-7-4 14:12 +0200:
 > ...
 > I cannot delete all my 
 > 
 > 	PortableHole 
 > 	User Folder
 > 	LinkedFolder
 > 
 > objects programmatically. But cache is deleted sucessfully. Did you kick me
 > from errors, please?
 > 
 > DTML Method:
 > 
 > <dtml-in "objectValues()" skip_unauthorized
 >     ><dtml-if   "meta_type in ('Accelerated HTTP Cache Manager',
 >                                'User Folder',
 >                                'LinkedFolder',
 >                                'PortableHole' )">
 >     DEL: <dtml-var title_or_id> absolute_url
 >     <dtml-call "manage_delObjects([_['id'],])"
 > ...
 > Error Type: BadRequest
 > Error Value: s does not exist
 > ...
 >   File /var/zope/lib/python/DocumentTemplate/DT_Util.py, line 159, in eval
 >     (Object: manage_delObjects([_['id'],]))
 >     (Info: manage_delObjects)
 >   File &lt;string&gt;, line 2, in f
 >   File /var/zope/lib/python/OFS/ObjectManager.py, line 441, in
 > manage_delObjects
 >     (Object: s)

You call the "manage_delObjects" on the object to be deleted and
not its container.

Try:

  <dtml-let container=this>
    <dtml-in "objectValues(['Accelerated...',
                            'User Folder',
			    ...
			    ])" ...>
      ...
      <dtml-call "container.manage_delObjects([getId()])">
      ...
    </dtml-in>
  </dtml-let>


Note that I also cleaned up other parts of your code.


Dieter