Example #1
0
    def start(self):
        Server.start(self)

        # Silences standard output from simple_server
        class quiet_handler(wsgiref.simple_server.WSGIRequestHandler):
            def log_message(self, format, *args):
                pass

        server = make_server(self.config["host"],
                             int(self.config["port"]),
                             self, handler_class=quiet_handler)
        server.serve_forever()
Example #2
0
 def serve(self, environ, start_response):
     uri = environ.get("PATH_INFO")
     reqres = Reqres(self.app.get_root(), uri)
     reqres.cookies.eat(environ.get("HTTP_COOKIE"))
     reqres.session.load()
     reqres.set_domain(environ.get("HTTP_HOST"))
     reqres.request_method = environ['REQUEST_METHOD'].lower()
     if environ["REQUEST_METHOD"].upper() == "POST":
         reqres.post = self._extract_post(environ)
     reqres = Server.serve(self, reqres)
     reqres.close()
     start_response(reqres.get_http_code(), reqres.get_http_headers())
     if reqres.flag_redirect:
         return ['']
     return [reqres.render().encode('utf-8')]