[Zope] Deleting an object from python (command line)
Stefan H. Holek
stefan@epy.co.at
Tue, 2 Oct 2001 19:30:53 +0200 (CEST)
On Tue, 2 Oct 2001, Gilles Lenfant wrote:
> Hi,
>
> I made a buggy access rule at the root of ZODB that makes the ZMI
> unreachable (error in Python script) I want to delete this accessrule so I
> stopped Zope and...
>
> % cd $ZOPEROOT/lib/python
> % $ZOPEROOT/bin/python
>
> >>> import Zope
> >>> app = Zope.app()
> >>> dir(app)
> [..., 'accessrule',...]
> >>> app.manage_delObjects(['accessrule'])
> >>> dir(app)
> [...] # no more "accessrule"
> >>> ^D
>
> but 'accessrule' is STILL HERE !
> When I do again :
>
> % $ZOPEROOT/bin/python
>
> >>> import Zope
> >>> app = Zope.app()
> >>> dir(app)
> [..., 'accessrule',...] # Thought it was deleted !!!
>
> Did I miss something ?
> Is there a "commit" like to do before quitting python?
Yep, it's called get_transaction().commit()
setting SUPPRESS_ACCESSRULE in the start script will disable the access
rules as well, BTW
Stefan