Deprecate WebSrv class.

pull/7/head
Ferry Boender 10 years ago
parent f28fd0aa34
commit 3fb1c092a1
  1. 16
      src/scriptform.py

@ -165,6 +165,7 @@ class ScriptForm:
self.callbacks = {} self.callbacks = {}
self.basepath = os.path.realpath(os.path.dirname(config_file)) self.basepath = os.path.realpath(os.path.dirname(config_file))
self.log = logging.getLogger('SCRIPTFORM') self.log = logging.getLogger('SCRIPTFORM')
self.websrv = None
def get_form_config(self): def get_form_config(self):
""" """
@ -217,7 +218,9 @@ class ScriptForm:
Ctrl-c. Ctrl-c.
""" """
ScriptFormWebApp.scriptform = self ScriptFormWebApp.scriptform = self
WebSrv(ScriptFormWebApp, listen_addr=listen_addr, listen_port=listen_port) self.httpd = ThreadedHTTPServer((listen_addr, listen_port), ScriptFormWebApp)
self.log.info("Listening on {0}:{1}".format(listen_addr, listen_port))
self.httpd.serve_forever()
class FormConfig: class FormConfig:
@ -499,17 +502,6 @@ class ThreadedHTTPServer(ThreadingMixIn, BaseHTTPServer.HTTPServer):
pass pass
class WebSrv:
"""
Very basic web server.
"""
def __init__(self, request_handler, listen_addr='', listen_port=80):
self.log = logging.getLogger('WEBSRV')
httpd = ThreadedHTTPServer((listen_addr, listen_port), request_handler)
self.log.info("Listening on {0}:{1}".format(listen_addr, listen_port))
httpd.serve_forever()
class WebAppHandler(BaseHTTPRequestHandler): class WebAppHandler(BaseHTTPRequestHandler):
""" """
Basic web server request handler. Handles GET and POST requests. This class Basic web server request handler. Handles GET and POST requests. This class

Loading…
Cancel
Save