[Tutor] Stopping a webservice

Timo timomlists at gmail.com
Thu Oct 21 00:15:28 CEST 2010


Hello,

I have written a Python script that constantly checks for incoming
connections. It is a class and runs a while loop until shutdown is set to
True. Something like:

class Connection(object):
    def __init__(self):
        self.shutdown = False

    def mainloop(self):
        while not self.shutdown:
            print "We keep checking..."

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?

Cheers,
Timo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101021/d32ad036/attachment.html>


More information about the Tutor mailing list