[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.9

Jeremy Hylton jeremy@zope.com
Tue, 11 Feb 2003 11:41:50 -0500


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv14531

Modified Files:
	http.py 
Log Message:
Remove unused import.

Move status_codes initialization to function to silence pychecker
warnings.  The code created globals named key and val, and those same
names were used as local variables in methods.


=== Zope3/src/zope/publisher/http.py 1.8 => 1.9 ===
--- Zope3/src/zope/publisher/http.py:1.8	Tue Feb 11 11:00:08 2003
+++ Zope3/src/zope/publisher/http.py	Tue Feb 11 11:41:47 2003
@@ -16,7 +16,7 @@
 $Id$
 """
 
-import re, time, random, sys
+import re, time, random
 from urllib import quote, splitport
 from types import StringTypes, UnicodeType, ClassType
 from cgi import escape
@@ -160,19 +160,22 @@
 }
 
 status_codes={}
-# Add mappings for builtin exceptions and
-# provide text -> error code lookups.
-for key, val in status_reasons.items():
-    status_codes[val.replace(' ', '').lower()] = key
-    status_codes[val.lower()] = key
-    status_codes[key] = key
-    status_codes[str(key)] = key
 
-en = [n.lower() for n in dir(__builtins__) if n.endswith('Error')]
+def init_status_codes():
+    # Add mappings for builtin exceptions and
+    # provide text -> error code lookups.
+    for key, val in status_reasons.items():
+        status_codes[val.replace(' ', '').lower()] = key
+        status_codes[val.lower()] = key
+        status_codes[key] = key
+        status_codes[str(key)] = key
 
-for name in en:
-    status_codes[name] = 500
+    en = [n.lower() for n in dir(__builtins__) if n.endswith('Error')]
 
+    for name in en:
+        status_codes[name] = 500
+
+init_status_codes()
 
 accumulate_header = {'set-cookie': 1}.has_key