Commit a0b9afd5 authored by jim's avatar jim

git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@73326 62d5b8a3-27da-0310-9561-8e5933582275
parent d1a70f2e
......@@ -242,7 +242,10 @@ class Server(BaseHTTPServer.HTTPServer):
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
Server.__log = False
def __init__(self, request, address, server):
self.__server = server
self.tree = server.tree
BaseHTTPServer.BaseHTTPRequestHandler.__init__(
self, request, address, server)
......@@ -251,6 +254,16 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
if '__stop__' in self.path:
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('/')))
if not (
((path == self.tree) or path.startswith(self.tree+os.path.sep))
......@@ -295,8 +308,9 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
self.wfile.write(out)
def log_request(*s):
pass
def log_request(self, code):
if self.__server.__log:
print '%s %s %s' % (self.command, code, self.path)
def _run(tree, port):
server_address = ('localhost', port)
......
......@@ -90,6 +90,19 @@ number of names to the test namespace:
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.
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)``
Create a source distribution by running the given setup file and
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