Commit 61202306 authored by Jim Fulton's avatar Jim Fulton

No commit message

No commit message
parent 01ff45c5
...@@ -242,14 +242,27 @@ class Server(BaseHTTPServer.HTTPServer): ...@@ -242,14 +242,27 @@ class Server(BaseHTTPServer.HTTPServer):
class Handler(BaseHTTPServer.BaseHTTPRequestHandler): class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
Server.__log = False
def __init__(self, request, address, server): def __init__(self, request, address, server):
self.__server = server
self.tree = server.tree self.tree = server.tree
BaseHTTPServer.BaseHTTPRequestHandler.__init__( BaseHTTPServer.BaseHTTPRequestHandler.__init__(
self, request, address, server) self, request, address, server)
def do_GET(self): def do_GET(self):
if '__stop__' in self.path: if '__stop__' in self.path:
raise SystemExit raise SystemExit
if self.path == '/enable_server_logging':
self.__server.__log = True
self.send_response(200)
return
if self.path == '/disable_server_logging':
self.__server.__log = False
self.send_response(200)
return
path = os.path.abspath(os.path.join(self.tree, *self.path.split('/'))) path = os.path.abspath(os.path.join(self.tree, *self.path.split('/')))
if not ( if not (
...@@ -295,8 +308,9 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler): ...@@ -295,8 +308,9 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
self.wfile.write(out) self.wfile.write(out)
def log_request(*s): def log_request(self, code):
pass if self.__server.__log:
print '%s %s %s' % (self.command, code, self.path)
def _run(tree, port): def _run(tree, port):
server_address = ('localhost', port) server_address = ('localhost', port)
......
...@@ -90,6 +90,19 @@ number of names to the test namespace: ...@@ -90,6 +90,19 @@ number of names to the test namespace:
Start a web server on the given path. The server will be shut Start a web server on the given path. The server will be shut
down at the end of the test. The server URL is returned. down at the end of the test. The server URL is returned.
You can cause the server to start and stop logging it's output
using:
>>> get(server_url+'enable_server_logging')
and:
>>> get(server_url+'enable_server_logging')
This can be useful to see how buildout is interacting with a
server.
``sdist(setup, dest)`` ``sdist(setup, dest)``
Create a source distribution by running the given setup file and Create a source distribution by running the given setup file and
placing the result in the given destination directory. If the placing the result in the given destination directory. If the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment