[Zope-dev] connecting server code to the ZODB
Tim Hicks
tim at sitefusion.co.uk
Thu Oct 28 11:37:07 EDT 2004
Hi,
I'm trying to figure out how to adjust Nikolay Kim's smtpserver code
<http://cvs.sourceforge.net/viewcvs.py/collective/smtpserver/> so that
objects within the ZODB can affect the way that messages are received
(i.e. veto messages based on certain criteria in the first instance).
My problem is that I don't quite know how to get hold of the ZODB objects.
As far as I can tell, Nikolay's
smtpserver.SMTPServer.SMTPChannel.process_message method uses
ZServer.PubCore.handle to make the connection, but I don't really
understand how this all works.
What I really want to be able to do from the server code is something like::
root = magic_that_gets_me_zodb_root()
account_manager = root['Control_Panel']['AccountManager']
account_manager.checkAccepts(msg)
I want calls like that to checkAccepts(msg) to be made a several points in
the SMTP session - say after each of the SMTP commands RCPT, MAIL, DATA,
etc. I only mention that in case there are implications for some
transaction jiggery-pokery (although I don't expect any of the
checkAccepts() type calls to need to write to the ZODB).
Any pointers much appreciated.
tim
More information about the Zope-Dev
mailing list