On 04/05/2013 01:02 PM, Tom P wrote:

ok, after much experimenting it looks like the solution is as follows:

class MyWebServer(object):
    def __init__(self):
  #      self.foo = "foo"  delete these from self
   #     self.bar = "bar"
        myServer = HTTPServer
        myServer.foo = "foo"  #define foo,bar here
        myServer.bar = "bar"

        self.httpd = myServer(('127.0.0.1', 8000), MyRequestHandler)

Then, in the request handler:
class MyRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        ss=self.server
        print ss.foo


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to