Skip to content

Commit 472377d

Browse files
committed
Remaining white-space clean-up.
1 parent 0238d3f commit 472377d

File tree

97 files changed

+1158
-1163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1158
-1163
lines changed

.checksrc.config

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# .checksrc.config
22
{
3-
'DisableErrors': {
4-
'UncapFN': ['clean', 'install'],
5-
}
3+
'DisableErrors': {
4+
'UncapFN': ['clean', 'install'],
5+
}
66
}

CGIWrapper/Docs/UsersGuide.phtml

+41-41
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
<p>The wrapper provides the following benefits:</p>
2525

2626
<ul>
27-
<li>Sets up global variables <em>headers</em>, <em>fields</em>, <em>env</em>, <em>wrapper</em> and <em>WebUtils</em> for use by the target script.</li>
28-
<li>Catches exceptions that the target script doesn't in order to provide a meaningful message to the web page reader and useful debugging information to the developer.</li>
29-
<li>Logs the date, time, duration and name of the target script for usage statistics and performance monitoring.</li>
30-
<li>Simplifies URLs by leaving out the extension and possibly the location of the script. This also hides the nature of the implementation of the page from the browser of your site.</li>
31-
<li>Provides a hook for integrating an object for cookies.</li>
32-
<li>Provides a hook for class-based CGIs.</li>
27+
<li>Sets up global variables <em>headers</em>, <em>fields</em>, <em>env</em>, <em>wrapper</em> and <em>WebUtils</em> for use by the target script.</li>
28+
<li>Catches exceptions that the target script doesn't in order to provide a meaningful message to the web page reader and useful debugging information to the developer.</li>
29+
<li>Logs the date, time, duration and name of the target script for usage statistics and performance monitoring.</li>
30+
<li>Simplifies URLs by leaving out the extension and possibly the location of the script. This also hides the nature of the implementation of the page from the browser of your site.</li>
31+
<li>Provides a hook for integrating an object for cookies.</li>
32+
<li>Provides a hook for class-based CGIs.</li>
3333
</ul>
3434

3535
<p>You don't have to immediately write code to play with CGI Wrapper. There are several samples included. See <a href="#Running">Running and Testing</a> below.</p>
@@ -42,29 +42,29 @@
4242
<table align="center" cellspacing="0" cellpadding="4" border="1" width="80%">
4343
<tr><th>Global</th> <th>Type/Class</th> <th>Description</th> </tr>
4444
<tr>
45-
<td><code>headers</code> </td>
46-
<td>dictionary </td>
47-
<td>Contains all the HTTP headers that will be sent back to the client. The default contents are 'Content-type': 'text/html'. Often, the headers don't need to be modified at all. One popular use of the headers is 'Redirect': 'someURL' to point the client to a different place. </td>
45+
<td><code>headers</code> </td>
46+
<td>dictionary </td>
47+
<td>Contains all the HTTP headers that will be sent back to the client. The default contents are 'Content-type': 'text/html'. Often, the headers don't need to be modified at all. One popular use of the headers is 'Redirect': 'someURL' to point the client to a different place. </td>
4848
</tr>
4949
<tr>
50-
<td><code>fields</code> </td>
51-
<td>cgi.FieldStorage </td>
52-
<td>This instance of FieldStorage comes from the standard Python cgi module. Typical uses include <code>fields.has_key('someField')</code> and <code>fields['someField'].value</code>. See the Python standard module documentation for cgi for more information. </td>
50+
<td><code>fields</code> </td>
51+
<td>cgi.FieldStorage </td>
52+
<td>This instance of FieldStorage comes from the standard Python cgi module. Typical uses include <code>fields.has_key('someField')</code> and <code>fields['someField'].value</code>. See the Python standard module documentation for cgi for more information. </td>
5353
</tr>
5454
<tr>
55-
<td><code>environ</code> </td>
56-
<td>dictionary </td>
57-
<td>This dictionary represents the environment variables passed to the CGI scripts. Scripts should use this rather than <code>os.environ</code> since future versions of CGI Wrapper could be tightly integrated into web servers, thereby changing the nature of how environment variables get passed around (e.g., no longer through the OS). Also, note that the environment may seem a little non-standard to the target CGI script since the web server is setting it up to run the CGI Wrapper instead. In most CGI scripts (that execute under the wrapper), the environment is not even needed. </td>
55+
<td><code>environ</code> </td>
56+
<td>dictionary </td>
57+
<td>This dictionary represents the environment variables passed to the CGI scripts. Scripts should use this rather than <code>os.environ</code> since future versions of CGI Wrapper could be tightly integrated into web servers, thereby changing the nature of how environment variables get passed around (e.g., no longer through the OS). Also, note that the environment may seem a little non-standard to the target CGI script since the web server is setting it up to run the CGI Wrapper instead. In most CGI scripts (that execute under the wrapper), the environment is not even needed. </td>
5858
</tr>
5959
<tr>
60-
<td><code>wrapper</code> </td>
61-
<td>CGIWrapper </td>
62-
<td>This is a pointer back to the CGI Wrapper instance. This allows CGI scripts to communicate with the wrapper if they want. However, this is hardly ever needed. </td>
60+
<td><code>wrapper</code> </td>
61+
<td>CGIWrapper </td>
62+
<td>This is a pointer back to the CGI Wrapper instance. This allows CGI scripts to communicate with the wrapper if they want. However, this is hardly ever needed. </td>
6363
</tr>
6464
<tr>
65-
<td><code>cookies</code> </td>
66-
<td>Cookie </td>
67-
<td>This global is <b>not</b> set up by the wrapper, but is looked for upon exit of the CGI script. See the <em>Cookies</em> section below for more information. </td>
65+
<td><code>cookies</code> </td>
66+
<td>Cookie </td>
67+
<td>This global is <b>not</b> set up by the wrapper, but is looked for upon exit of the CGI script. See the <em>Cookies</em> section below for more information. </td>
6868
</tr>
6969
</table>
7070

@@ -74,11 +74,11 @@
7474
<p>One of the main benefits of the wrapper is the handling of uncaught exceptions raised by target CGI scripts. The typical behavior of the wrapper upon detecting an uncaught exception is:</p>
7575

7676
<ol>
77-
<li>Log the time, error, script name and traceback to <code>stderr</code>. This information will typically appear in the web server's error log.</li>
78-
<li>Display a web page containing an apologetic message to the user and useful debugging information for developers.</li>
79-
<li>Save the above web page to a file so that developers can look at it after-the-fact. These HTML-based error messages are stored one-per-file, if the <code>SaveErrorMessages</code> setting is true (the default). They are stored in the directory named by the <code>ErrorMessagesDir</code> (defaults to 'ErrorMsgs').</li>
80-
<li>Add an entry to the CGI Wrapper's error log, called <i>Errors.csv</i>.</li>
81-
<li>E-mail the error message if the <code>EmailErrors</code> setting is true, using the settings <code>ErrorEmailServer</code> and <code>ErrorEmailHeaders</code>.</li>
77+
<li>Log the time, error, script name and traceback to <code>stderr</code>. This information will typically appear in the web server's error log.</li>
78+
<li>Display a web page containing an apologetic message to the user and useful debugging information for developers.</li>
79+
<li>Save the above web page to a file so that developers can look at it after-the-fact. These HTML-based error messages are stored one-per-file, if the <code>SaveErrorMessages</code> setting is true (the default). They are stored in the directory named by the <code>ErrorMessagesDir</code> (defaults to 'ErrorMsgs').</li>
80+
<li>Add an entry to the CGI Wrapper's error log, called <i>Errors.csv</i>.</li>
81+
<li>E-mail the error message if the <code>EmailErrors</code> setting is true, using the settings <code>ErrorEmailServer</code> and <code>ErrorEmailHeaders</code>.</li>
8282
</ol>
8383

8484
<p>Archived error messages can be browsed through the <a href="#Administration">administration page</a>.</p>
@@ -386,21 +386,21 @@ A list of IP addresses or networks from which admin scripts can be accessed.
386386
<a name="ToDo"></a><h3>To Do</h3>
387387

388388
<ol>
389-
<li>Examples: Make a Cookie example. (In the meantime, just see the main doc string of Cookie.py in WebUtils.)</li>
390-
<li>Wrapper: When a script produces no output, the CGI Wrapper should report that problem. (This most often happens for class based CGIs with incorrect class names.)</li>
391-
<li>Wrapper: There should probably be an option to clear the output of a script that raised an uncaught exception. Sometimes that could help in debugging.</li>
392-
<li>Admin: Create a summary page for the script and error logs.</li>
393-
<li>Wrapper: It's intended that the CGIWrapper class could be embedded in a server and a single instance reused several times. The class is not quite there yet.</li>
394-
<li>Wrapper: CGI scripts never get cached as byte code (.pyc) which would provide a performance boost.</li>
395-
<li>Wrapper: The error log columns should be configurable just like the script log columns.</li>
396-
<li>Code review: Misc functions towards bottom of CGIWrapper</li>
397-
<li>Code review: Use of _realStdout and sys.stdout on multiple serve() calls.</li>
398-
<li>Wrapper: Create a subclass of Python's CGI server that uses CGIWrapper. This would include caching the byte code in memory.</li>
399-
<li>Wrapper: htmlErrorPageFilename() uses a "mostly works" technique that could be better. See source.</li>
400-
<li>Wrapper: Keep a list of file extensions (such as .py .html .pl) mapped to their handlers. When processing a URL, iterate through the list until a file with that extension is found, then serve it up through its handler.</li>
401-
<li>Admin: Add password protection on the administration scripts.</li>
402-
<li>Wrapper: Provide integration (and therefore increased performance) with web servers such as Apache.</li>
403-
<li>Wrapper: Error e-mails are always in HTML format. It may be useful to have a plain text version for those with more primitive e-mail clients.</li>
389+
<li>Examples: Make a Cookie example. (In the meantime, just see the main doc string of Cookie.py in WebUtils.)</li>
390+
<li>Wrapper: When a script produces no output, the CGI Wrapper should report that problem. (This most often happens for class based CGIs with incorrect class names.)</li>
391+
<li>Wrapper: There should probably be an option to clear the output of a script that raised an uncaught exception. Sometimes that could help in debugging.</li>
392+
<li>Admin: Create a summary page for the script and error logs.</li>
393+
<li>Wrapper: It's intended that the CGIWrapper class could be embedded in a server and a single instance reused several times. The class is not quite there yet.</li>
394+
<li>Wrapper: CGI scripts never get cached as byte code (.pyc) which would provide a performance boost.</li>
395+
<li>Wrapper: The error log columns should be configurable just like the script log columns.</li>
396+
<li>Code review: Misc functions towards bottom of CGIWrapper</li>
397+
<li>Code review: Use of _realStdout and sys.stdout on multiple serve() calls.</li>
398+
<li>Wrapper: Create a subclass of Python's CGI server that uses CGIWrapper. This would include caching the byte code in memory.</li>
399+
<li>Wrapper: htmlErrorPageFilename() uses a "mostly works" technique that could be better. See source.</li>
400+
<li>Wrapper: Keep a list of file extensions (such as .py .html .pl) mapped to their handlers. When processing a URL, iterate through the list until a file with that extension is found, then serve it up through its handler.</li>
401+
<li>Admin: Add password protection on the administration scripts.</li>
402+
<li>Wrapper: Provide integration (and therefore increased performance) with web servers such as Apache.</li>
403+
<li>Wrapper: Error e-mails are always in HTML format. It may be useful to have a plain text version for those with more primitive e-mail clients.</li>
404404
</ol>
405405

406406

CGIWrapper/Examples/Colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
''' % (bgcolorArg, bgcolor)
2323

2424
space = '&nbsp;'*10
25-
gamma = 2.2 # an approximation for today's CRTs, see "brightness =" below
25+
gamma = 2.2 # an approximation for today's CRTs, see "brightness =" below
2626

2727
for r in range(11):
2828
r /= 10.0

COMKit/Examples/ADOSample.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# can be shared among many servlets.
1616

1717
from win32com.client import Dispatch
18+
1819
from ExamplePage import ExamplePage
1920

2021

@@ -39,11 +40,13 @@ def recordset(self, sql):
3940

4041
def writeContent(self):
4142
# Grab some data from the database and display it
42-
rs = self.recordset('SELECT CustomerName FROM Customers ORDER BY CustomerName')
43-
self.writeln('<h1>ADO Sample</h1>')
44-
self.writeln('<h3>Your Customers are:</h3>')
45-
self.writeln('<ul>')
43+
wr = self.writeln
44+
wr('<h1>ADO Sample</h1>')
45+
wr('<h3>Your Customers are:</h3>')
46+
rs = self.recordset(
47+
'SELECT CustomerName FROM Customers ORDER BY CustomerName')
48+
wr('<ul>')
4649
while not rs.EOF:
47-
self.writeln('<li>%s</li>' % rs.Fields('CustomerName').Value)
50+
wr('<li>%s</li>' % rs.Fields('CustomerName').Value)
4851
rs.MoveNext()
49-
self.writeln('</ul>')
52+
wr('</ul>')

COMKit/Properties.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
version = ('X', 'Y', 0)
44

55
docs = [
6-
{'name': "User's Guide", 'file': 'UsersGuide.html'},
6+
{'name': "User's Guide", 'file': 'UsersGuide.html'},
77
]
88

99
status = 'stable'
@@ -15,7 +15,7 @@
1515
requiredOpSys = 'nt'
1616

1717
requiredSoftware = [
18-
{'name': 'pythoncom'},
18+
{'name': 'pythoncom'},
1919
]
2020

2121
def willRunFunc():
@@ -28,8 +28,8 @@ def willRunFunc():
2828
for soft in requiredSoftware:
2929
imp.find_module(soft['name'])
3030
except ImportError:
31-
success = 0
31+
success = False
3232
else:
33-
success = 1
33+
success = True
3434
if not success:
3535
return 'The pythoncom module (pywin32 library) is required to use COMKit.'

DocSupport/.checksrc.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# checksrc.config
22
{
3-
'SkipFiles': ['autotoc', 'pytp', 'py2html']
3+
'SkipFiles': ['autotoc', 'pytp', 'py2html']
44
}

DocSupport/PySummary.config

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'html': {
3-
'tabSubstitute': ' '*4, # eg, 4 spaces per tab
3+
'tabSubstitute': ' '*4, # eg, 4 spaces per tab
44
'file': ('''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
55
<html xmlns="http://www.w3.org/1999/xhtml">
66
<head>
@@ -30,16 +30,16 @@ or the <a href="../Docs/%(package)s.html">generated documentation</a>.</p>
3030
</body>
3131
</html>'''),
3232

33-
'class': ('\n', ''),
34-
'def': ('', ''),
33+
'class': ('\n', ''),
34+
'def': ('', ''),
3535
'category': ('\n', ''),
3636
},
3737

3838
'text': {
39-
'tabSubstitute': ' '*4, # eg, 4 spaces per tab
40-
'file': ('', ''),
41-
'class': ('\n', ''),
42-
'def': ('', ''),
43-
'category': ('\n', ''),
39+
'tabSubstitute': ' '*4, # eg, 4 spaces per tab
40+
'file': ('', ''),
41+
'class': ('\n', ''),
42+
'def': ('', ''),
43+
'category': ('\n', ''),
4444
},
4545
}

DocSupport/RelNotesTemplate.phtml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@
44

55
<a name="Introduction"></a><h2>Introduction</h2>
66
<ul>
7-
<li>...</li>
7+
<li>...</li>
88
</ul>
99

1010
<a name="MajorChanges"></a><h2>Major Changes</h2>
1111
<ul>
12-
<li>...</li>
12+
<li>...</li>
1313
</ul>
1414

1515
<a name="NewFeatures"></a><h2>New Features</h2>
1616
<ul>
17-
<li>...</li>
17+
<li>...</li>
1818
</ul>
1919

2020
<a name="Improvements"></a><h2>Improvements and Refinements</h2>
2121
<ul>
22-
<li>...</li>
22+
<li>...</li>
2323
</ul>
2424

2525
<a name="Security"></a><h2>Security</h2>
2626
<ul>
27-
<li>...</li>
27+
<li>...</li>
2828
</ul>
2929

3030
<a name="MinorChanges"></a><h2>Minor API Changes</h2>
3131
<ul>
32-
<li>...</li>
32+
<li>...</li>
3333
</ul>
3434

3535
<a name="Bugfixes"></a><h2>Bugfixes</h2>
3636
<ul>
37-
<li>...</li>
37+
<li>...</li>
3838
</ul>
3939

40-
<% footer() %>
40+
<% footer() %>

0 commit comments

Comments
 (0)