[Tutor] Stopping a webservice

Alan Gauld alan.gauld at btinternet.com
Thu Oct 21 00:50:24 CEST 2010


"Timo" <timomlists at gmail.com> wrote

> I have written a GUI and when I click the Quit-button, I do
> "connection.shutdown = True", which works great.
>
> The plans are to run this on my webserver. I created a webpage with 
> a start
> and stop button, the starting works great. But how could I remember 
> this
> class to call "class.shutdown = True" any given time when I press 
> the stop
> button?

There arec several ways but one would be to pass the connection
object ID as a cookie and then when Quiting usend the cookie data to 
the
server which ises it to referenbce the connection object - a 
dictionary
might be useful here...

Thats assuming you havf multiple connection objects running, maybe 
even
one per client sesssion. If its a global conmnection objerct then just 
store
it as a global object (maybe in its own module imported by all other
modules?)

There are several other options but those are probably the two 
simplest
depending on your use case.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list