[XML-SIG] Two SimpleXMLRPCServer questions
Mark Bucciarelli
mark@easymailings.com
Mon, 10 Mar 2003 13:21:42 -0500
On Monday 10 March 2003 1:22 pm, Brian Quinlan wrote:
> > I use ZODB to store the queue data. I can't figure out how to pass
> > the ZODB file name in as a command parameter to the script.
>
> I don't know what you mean.
Right now, I register a class that holds all the server methods. In a custom
_dispatch method, I check to see if the server is "started." If it's not,
then I start it, meaning that I open a connection to the ZODB database. In
order to open this connection, I need to have the filename of the persistent
storage.
What I would like to do is pass this file name into the script that starts up
the server as a command-line parameter. I can't figure out how to get this
file name and give it to the class so the _dispatch has access to it.
I could make an xmlrpc connection in another thread and then call a setup
method via HTTP POST, but that seems a bit kludgy and I was hoping for a more
elegant solution.
> > The other question I have is how to make this server stop (and perhaps
> > finish it's work) when someone presses a control-C in the console.
>
> Look at SimpleXMLRPCRequestHandler.do_POST. You might want to create
> your own subclass and modify that method such that KeyboardInterrupts
> set g_quit.
Won't this only work if the do_POST is running?
Mark