From 110c3a33a34a2566acf620e7b185ef1b16144b7a Mon Sep 17 00:00:00 2001 From: "Phillip J. Eby" Date: Sat, 18 Sep 2004 23:46:50 +0000 Subject: [PATCH] Get rid of tabs that sneaked into sample code. --- pep-0333.txt | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pep-0333.txt b/pep-0333.txt index 00925fabf..05ec22828 100644 --- a/pep-0333.txt +++ b/pep-0333.txt @@ -253,7 +253,7 @@ server. # Re-raise original exception if headers sent raise exc_info[0], exc_info[1], exc_info[2] finally: - exc_info = None # avoid dangling circular ref + exc_info = None # avoid dangling circular ref elif headers_sent: raise AssertionError("Headers already sent!") @@ -263,8 +263,8 @@ server. result = application(environ, start_response) try: for data in result: - if data: # don't send headers until body appears - write(data) + if data: # don't send headers until body appears + write(data) if not headers_sent: write('') # send headers now if body was empty finally: @@ -329,20 +329,20 @@ a block boundary.) its first non-empty string, so 'transform_ok' has to be a mutable truth value.""" - def __init__(self,result,transform_ok): - if hasattr(result,'close'): + def __init__(self,result,transform_ok): + if hasattr(result,'close'): self.close = result.close self._next = iter(result).next self.transform_ok = transform_ok - def __iter__(self): - return self - - def next(self): - if self.transform_ok: - return piglatin(self._next()) - else: - return self._next() + def __iter__(self): + return self + + def next(self): + if self.transform_ok: + return piglatin(self._next()) + else: + return self._next() class Latinator: @@ -361,28 +361,28 @@ a block boundary.) for name,value in headers: if name.lower()=='content-type' and value=='text/plain': transform_ok.append(True) - # Strip content-length if present, else it'll be wrong - headers = [(name,value) - for name,value in headers - if name.lower()<>'content-length' - ] - break + # Strip content-length if present, else it'll be wrong + headers = [(name,value) + for name,value in headers + if name.lower()<>'content-length' + ] + break - write = start_response(status,headers,exc_info) + write = start_response(status,headers,exc_info) if transform_ok: - def write_latin(data): - write(piglatin(data)) - return write_latin + def write_latin(data): + write(piglatin(data)) + return write_latin else: return write return LatinIter(self.application(environ,start_latin),transform_ok) - # Run foo_app under a Latinator's control, using the example CGI gateway - from foo_app import foo_app - run_with_cgi(Latinator(foo_app)) + # Run foo_app under a Latinator's control, using the example CGI gateway + from foo_app import foo_app + run_with_cgi(Latinator(foo_app)) @@ -752,7 +752,7 @@ involved. The simplest way to do this is something like:: try: # do stuff w/exc_info here finally: - exc_info = None # Avoid circular ref. + exc_info = None # Avoid circular ref. The example CGI gateway provides another illustration of this technique.