[Checkins] SVN: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py Added conditional logging support to the static layer. The host and port are taken from the base layer

Jan-Jaap Driessen jdriessen at thehealthagency.com
Wed Nov 17 10:25:52 EST 2010


Log message for revision 118441:
  Added conditional logging support to the static layer. The host and port are taken from the base layer

Changed:
  U   gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py

-=-
Modified: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py
===================================================================
--- gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py	2010-11-17 15:24:42 UTC (rev 118440)
+++ gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py	2010-11-17 15:25:51 UTC (rev 118441)
@@ -17,7 +17,7 @@
 import os.path
 import posixpath
 import shutil
-import SimpleHTTPServer
+from SimpleHTTPServer import SimpleHTTPRequestHandler
 import tempfile
 import threading
 import time
@@ -29,7 +29,7 @@
 _suffix = 'gocept.selenium.static'
 
 
-class StaticFileRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+class StaticFileRequestHandler(SimpleHTTPRequestHandler):
 
     # The documentroot is set on the class just before passing the class on
     # to the BaseHTTPServer.HTTPServer.
@@ -56,8 +56,10 @@
             path = os.path.join(path, word)
         return path
 
+    # Add conditional logging to handler.
     def log_request(self, *args):
-        pass
+        if 'GOCEPT_SELENIUM_VERBOSE_LOGGING' in os.environ:
+            SimpleHTTPRequestHandler.log_request(self, *args)
 
 
 class HTTPServer(BaseHTTPServer.HTTPServer):
@@ -76,9 +78,6 @@
 
 class StaticFilesLayer(gocept.selenium.base.Layer):
 
-    host = 'localhost'
-    port = 5698
-
     def setUp(self):
         super(StaticFilesLayer, self).setUp()
         self.server = None



More information about the checkins mailing list