[Python-checkins] python/nondist/peps pep-0333.txt,1.20,1.21

pje at users.sourceforge.net pje at users.sourceforge.net
Wed Oct 6 08:23:58 CEST 2004


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30001

Modified Files:
	pep-0333.txt 
Log Message:
Fix misc. coding errors found while testing the reference library.


Index: pep-0333.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0333.txt,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- pep-0333.txt	1 Oct 2004 20:03:01 -0000	1.20
+++ pep-0333.txt	6 Oct 2004 06:23:54 -0000	1.21
@@ -221,7 +221,7 @@
         environ['wsgi.version']      = (1,0)
         environ['wsgi.multithread']  = False
         environ['wsgi.multiprocess'] = True
-        environ['wsgi.last_call']    = True
+        environ['wsgi.run_once']    = True
 
         if environ.get('HTTPS','off') in ('on','1'):
             environ['wsgi.url_scheme'] = 'https'
@@ -254,8 +254,8 @@
                         raise exc_info[0], exc_info[1], exc_info[2]
                 finally:
                     exc_info = None     # avoid dangling circular ref
-            elif headers_sent:
-                raise AssertionError("Headers already sent!")
+            elif headers_set:
+                raise AssertionError("Headers already set!")
                 
             headers_set[:] = [status,response_headers]
             return write
@@ -1239,6 +1239,7 @@
 If an application wishes to reconstruct a request's complete URL, it
 may do so using the following algorithm, contributed by Ian Bicking::
 
+    from urllib import quote
     url = environ['wsgi.url_scheme']+'://'
 
     if environ.get('HTTP_HOST'):
@@ -1247,14 +1248,14 @@
         url += environ['SERVER_NAME']
 
     if environ['wsgi.url_scheme'] == 'https':
-        if environ['SERVER_PORT'] != '443'
+        if environ['SERVER_PORT'] != '443':
            url += ':' + environ['SERVER_PORT']
     else:
         if environ['SERVER_PORT'] != '80':
            url += ':' + environ['SERVER_PORT']
 
-    url += environ.get('SCRIPT_NAME','')
-    url += environ.get('PATH_INFO','')
+    url += quote(environ.get('SCRIPT_NAME',''))
+    url += quote(environ.get('PATH_INFO',''))
     if environ.get('QUERY_STRING'):
         url += '?' + environ['QUERY_STRING']
 



More information about the Python-checkins mailing list