Mailing List Archive

Issues with programmatically deleting objects
Hi All,

I am new to Zope, using Zope 2.7 and wrote a "Script Python" to delete
objects programatically(used for bulk delete).

parent.manage_delObjects(id)

After I execute the script using the Test button of the ZMI, the objects are
getting deleted properly.

But in the Undo tab, I am not able to see the transaction history
(/mysite/path/manage_delObjects by *niv)*

When I tried to add transaction.commit() the ZMI is asking for credentials.

1. How do I get the transaction recorded using Script Python?
2. Are there any other ways to achieve the same?

3. Another issue is, when I tried to invoke the delete Script Python from an
external python script using xmlrpc it threw a xmlrpclib.ProtocolError 401
Unauthorized Error. Is it because there is a manage_delObjects call?

Regs,
Niv
Re: Issues with programmatically deleting objects [ In reply to ]
Hi Niv,

Probably, in your Undo tab, you do see an item which corresponds to the
execution of your test script. Because this script executed the
manage_delObjects() method, you need to undo that entry to undo the
deletion.

As I do not have any experience with xmlrpclib, I can just give you a
general pointer about debugging your code. If you remove the
manage_delObjects command from the script, and execute it via your
external script, does it still throw the same error? If not, it is
probably the call to manage_delObjects that is causing the problem.

Also check the error traceback in the Zope error_log to see what threw
the error.

Regards,
Bart


On 15-09-11 14:29, niveditha j wrote:
> Hi All,
>
> I am new to Zope, using Zope 2.7 and wrote a "Script Python" to delete
> objects programatically(used for bulk delete).
>
> parent.manage_delObjects(id)
>
> After I execute the script using the Test button of the ZMI, the objects
> are getting deleted properly.
>
> But in the Undo tab, I am not able to see the transaction history
> (/mysite/path/manage_delObjects by *niv)*
>
> When I tried to add transaction.commit() the ZMI is asking for credentials.
>
> 1. How do I get the transaction recorded using Script Python?
> 2. Are there any other ways to achieve the same?
>
> 3. Another issue is, when I tried to invoke the delete Script Python
> from an external python script using xmlrpc it threw
> a xmlrpclib.ProtocolError 401 Unauthorized Error. Is it because there is
> a manage_delObjects call?
>
> Regs,
> Niv
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> https://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> https://mail.zope.org/mailman/listinfo/zope-announce
> https://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________
Zope maillist - Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )