Paul Winkler said:
What I really want to be able to do from the server code is something like::
root = magic_that_gets_me_zodb_root()
That magic is basically (from memory):
import Zope Zope.startup() root = Zope.app()
But note that starting up a zope is slow, so you don't want to do that very often.
Well, in this case zope is already running.
Ok, so I could simply drop the Zope.startup() line and things would be fine (and quick), right?
I think you should use the existing publisher machinery. Given an SMTPRequest instance foo, you should be able to do foo.traverse(path, response) and get back an object. This monster method is defined in ZPublisher/BaseRequest.py
What does using foo.traverse() buy me over simply accessing the ZODB objects 'by hand', as in root = Zope.app()? It seems I get security by using foo.traverse() - although I'm not sure whether that is really necessary for my purposes. Would it also deal with any ZODB transaction stuff for me that I would otherwise have to sort out - get_transaction().commit(). If I'm just reading ZODB objects (not writing), does the transaction stuff even matter? thanks, tim