Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42953
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Tom P <werotizy@freent.dd> |
| Newsgroups | comp.lang.python |
| Subject | Re: The SOLUTION HTTPserver: how to access variables of a higher class |
| Date | Sat, 06 Apr 2013 23:38:25 +0200 |
| Lines | 21 |
| Message-ID | <asbiuiFo2c5U1@mid.individual.net> (permalink) |
| References | <as7paeFs5e9U1@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net EDK1d+zY7v3EyZf4glYlYQXAFjbYqu5nkOh62ZOwgkgh12N+s= |
| Cancel-Lock | sha1:1HmGLjAmTIsvVN4Os06J0Cwencw= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
| In-Reply-To | <as7paeFs5e9U1@mid.individual.net> |
| Xref | csiph.com comp.lang.python:42953 |
Show key headers only | View raw
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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
HTTPserver: how to access variables of a higher class? Tom P <werotizy@freent.dd> - 2013-04-05 13:02 +0200
Re: HTTPserver: how to access variables of a higher class? Dave Angel <davea@davea.name> - 2013-04-05 07:54 -0400
Re: HTTPserver: how to access variables of a higher class? Tom P <werotizy@freent.dd> - 2013-04-05 15:26 +0200
Re: HTTPserver: how to access variables of a higher class? Tom P <werotizy@freent.dd> - 2013-04-05 23:41 +0200
Re: HTTPserver: how to access variables of a higher class? Dave Angel <davea@davea.name> - 2013-04-05 23:19 -0400
Re: HTTPserver: how to access variables of a higher class? Dylan Evans <dylan@dje.me> - 2013-04-05 22:27 +1000
Re: HTTPserver: how to access variables of a higher class? Tom P <werotizy@freent.dd> - 2013-04-05 15:21 +0200
Re: HTTPserver: how to access variables of a higher class? Tom P <werotizy@freent.dd> - 2013-04-06 17:05 +0200
Re: HTTPserver: how to access variables of a higher class? Dylan Evans <dylan@dje.me> - 2013-04-07 11:51 +1000
Re: The SOLUTION HTTPserver: how to access variables of a higher class Tom P <werotizy@freent.dd> - 2013-04-06 23:38 +0200
csiph-web