Author: chrisz
Date: Wed Aug 23 15:35:09 2006
New Revision: 5640
Modified:
Webware/trunk/AllTests.py
Webware/trunk/MiscUtils/Configurable.py
Webware/trunk/WebKit/AppServer.py
Webware/trunk/WebKit/Application.py
Webware/trunk/WebKit/ThreadedAppServer.py
Log:
Cosmetic changes.
Modified: Webware/trunk/AllTests.py
==============================================================================
--- Webware/trunk/AllTests.py (original)
+++ Webware/trunk/AllTests.py Wed Aug 23 15:35:09 2006
@@ -41,17 +41,17 @@
]
try:
- import unittest
+ import unittest
except ImportError: # Python < 2.1
- print "This module needs the Python unittest package (PyUnit)"
- print "available at http://pyunit.sourceforge.net"
- raise
+ print "This module needs the Python unittest package (PyUnit)"
+ print "available at http://pyunit.sourceforge.net"
+ raise
try:
- import logging
+ import logging
except ImportError: # Python < 2.3
- print "This module needs the Python logging system"
- print "available at http://www.red-dove.com/python_logging.html"
- raise
+ print "This module needs the Python logging system"
+ print "available at http://www.red-dove.com/python_logging.html"
+ raise
try:
True, False
except NameError: # Python < 2.3
@@ -108,7 +108,7 @@
if not os.path.exists(theFilename):
_log.info(' Creating new configuration file at "%s".'
' You can customize it to run more tests.', theFilename)
- fp= open(theFilename, 'w')
+ fp = open(theFilename, 'w')
fp.write(_AllTestsConfig._DEFAULT_CONFIG)
fp.close()
@@ -142,7 +142,7 @@
if os.path.exists(ap):
site.addsitedir(ap)
else:
- numBadPaths = numBadPaths + 1
+ numBadPaths += 1
print 'WARNING: Trying to add paths to sys.path,'
print ' but could not find "%s".' % ap
Modified: Webware/trunk/MiscUtils/Configurable.py
==============================================================================
--- Webware/trunk/MiscUtils/Configurable.py (original)
+++ Webware/trunk/MiscUtils/Configurable.py Wed Aug 23 15:35:09 2006
@@ -153,8 +153,8 @@
try:
True, False
except NameError: # Python < 2.3
- evalContext['True'] = 1==1
- evalContext['False'] = 1==0
+ evalContext['True'] = 1
+ evalContext['False'] = 0
try:
if isDict:
config = eval(contents, evalContext)
Modified: Webware/trunk/WebKit/AppServer.py
==============================================================================
--- Webware/trunk/WebKit/AppServer.py (original)
+++ Webware/trunk/WebKit/AppServer.py Wed Aug 23 15:35:09 2006
@@ -470,5 +470,5 @@
print_exc(1)
print "WebKit cannot terminate the running process."
-if __name__=='__main__':
+if __name__ == '__main__':
main()
Modified: Webware/trunk/WebKit/Application.py
==============================================================================
--- Webware/trunk/WebKit/Application.py (original)
+++ Webware/trunk/WebKit/Application.py Wed Aug 23 15:35:09 2006
@@ -418,10 +418,10 @@
filename = self.serverSidePath(
self.setting('ActivityLogFilename'))
if os.path.exists(filename):
- file = open(filename, 'a')
+ f = open(filename, 'a')
else:
- file = open(filename, 'w')
- file.write(','.join(self.setting('ActivityLogColumns'))+'\n')
+ f = open(filename, 'w')
+ f.write(','.join(self.setting('ActivityLogColumns')) + '\n')
values = []
# We use UserDict on the next line because we know it inherits
# NamedValueAccess and reponds to valueForName()
@@ -444,9 +444,8 @@
else:
value = str(value)
values.append(value)
- file.write(','.join(values)+'\n')
- file.close()
-
+ f.write(','.join(values) + '\n')
+ f.close()
for i in objects.keys():
objects[i] = None
@@ -771,7 +770,7 @@
# @@ 2003-02 ib: does anyone care?
pass
- def handleMissingPathSession(self,transaction):
+ def handleMissingPathSession(self, transaction):
"""Redirect requests without session info in the path.
if UseAutomaticPathSessions is enabled in Application.config
@@ -841,7 +840,7 @@
Largely historical.
"""
-if __name__=='__main__':
+if __name__ == '__main__':
if len(sys.argv) != 2:
sys.stderr.write('WebKit: Application: Expecting one filename argument.\n')
requestDict = eval(open(sys.argv[1]).read())
Modified: Webware/trunk/WebKit/ThreadedAppServer.py
==============================================================================
--- Webware/trunk/WebKit/ThreadedAppServer.py (original)
+++ Webware/trunk/WebKit/ThreadedAppServer.py Wed Aug 23 15:35:09 2006
@@ -346,7 +346,7 @@
self.spawnThread()
elif average < self._threadCount - margin and \
self._threadCount > self._minServerThreads:
- n=min(self._threadCount - self._minServerThreads,
+ n = min(self._threadCount - self._minServerThreads,
self._threadCount - max)
self.absorbThread(n)
else:
@@ -796,7 +796,6 @@
verbose = self._server._verbose
self._startTime = time.time()
- data = []
requestDict = self.receiveDict()
if not requestDict:
return
@@ -824,7 +823,7 @@
sys.stdout.write('%5i %s %s\n\n' % (self._requestID,
duration, requestURI))
- transaction._application=None
+ transaction._application = None
transaction.die()
del transaction
@@ -939,7 +938,6 @@
def shutDown(signum, frame):
"""Signal handler for shutting down the server."""
- global server
print
print "App server has been signaled to shutdown."
if server and server.running > 2:
|