From c029c079a21c7a25c27bce82c097606afeb91c1f Mon Sep 17 00:00:00 2001 From: "Phillip J. Eby" Date: Wed, 6 Oct 2004 06:23:54 +0000 Subject: [PATCH] Fix misc. coding errors found while testing the reference library. --- pep-0333.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pep-0333.txt b/pep-0333.txt index b4b5cff43..fd66a51ad 100644 --- a/pep-0333.txt +++ b/pep-0333.txt @@ -221,7 +221,7 @@ server. 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 @@ server. 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 @@ URL Reconstruction 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 @@ may do so using the following algorithm, contributed by Ian Bicking:: 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']