[Zope] manage_delObjects()

Andreas Jung lists at andreas-jung.com
Wed Mar 23 12:34:15 EST 2005



--On Mittwoch, 23. März 2005 12:37 Uhr -0400 Leticia Larrosa 
<LETICIA at tesla.cujae.edu.cu> wrote:

> Hi all:
> In an python script i put the following code:
> "container.manage_delObjects([container.exampleFolder.getId()])" where
> "exampleFolder" is the
> name of an object of type "Folder" in the "container". This code delete
> the  "exampleFolder" OK.
> But when I have the name of the "Folder" that i want to delete in a
> variable  and call the
> "manage_delObjects", example:
> folderToDelete = "exampleFolder"
> container.manage_delObjects([container[folderToDelete]])
># or
> container.manage_delObjects([getattr(container, folderToDelete)])
> ----------------------------
> I get the following error:
> Error Type: AttributeError
> Error Value: __getslice__
> -----------------------------
> The Traceback:
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 101, in publish
>   Module ZPublisher.mapply, line 88, in mapply
>   Module ZPublisher.Publish, line 39, in call_object
>   Module Shared.DC.Scripts.Bindings, line 306, in __call__
>   Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
>   Module Products.PythonScripts.PythonScript, line 323, in _exec
>   Module None, line 18, in update
>    - <PythonScript at
> /approach/SiccApproach/Configuration/AuthenticationTypes/update>
>    - Line 18
>   Module OFS.ObjectManager, line 453, in manage_delObjects
>   Module OFS.ObjectManager, line 241, in _getOb
> AttributeError: __getslice__

manage_delObjects() takes a list of object *ids* and not of objects.

-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050323/456d0b7e/attachment.bin


More information about the Zope mailing list