[Zope] how to delete an object from python??
Dieter Maurer
dieter@handshake.de
Thu, 16 Aug 2001 20:59:57 +0200 (CEST)
Robert Rottermann writes:
> I wonder how to delete an object from a python script.
> When I try
> oName = context.this().getId()
> f = context.REQUEST.PARENTS[1]
> f._delObject( oName )
> I can not even save the script because zope complains that
> SyntaxError, Names starting with "_" are not allowed (_delObject).
As a rule of thumb:
Objects starting with '_' indicate private objects;
to be used only for internal tasks, usually not used
from outside the class.
Zope's security enforces part of this privacy....
There is an "official" method to delete object:
"manage_delObjects".
As the name suggests, it deletes a list (!) of objects, identified
by id. Its a method of "ObjectManager".
Dieter