On Mon, 17 Jul 2000, Shane Hathaway wrote:
> The way to get the root application object is to open a connection to
> the ZODB and get the 'Application' object from the list of root
> objects. There is an easy shortcut:
> import Zope
> app = Zope.app()
> app now refers to a *copy* of the root Application object.
Yeehaw, that worked! I was so close. :-)
> When you're done modifying it and its descendants you have to commit or
> abort the transaction.
Do I need to commit or abort even if I don't make changes to the
application object? The only thing I need it for is to get to the
Control_Panel; I am instantiating ZClass instances in the constructor of a
Python class, i.e.:
def __init__(self, id, title=''):
app = Zope.app()
ob = app.Control_Panel.Products.MyProduct.MyZClass('newId')
ob.id = 'newId'
# Do I need a get_transaction().abort() here? Will that not abort
# the wrong transaction?
> This gives you all kinds of benefits like undo and elimination of
> threading conflicts.
Good stuff. Thanks, Shane.
Jeff K. Hoffman 704.849.0731 x108
Chief Technology Officer mailto:[EMAIL PROTECTED]
Going Virtual, L.L.C. http://www.goingv.com/
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -