Commit 91b5cb3f authored by Tres Seaver's avatar Tres Seaver

- Whitespace normalization.

parent 7c228e39
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
'''CGI Response Output formatter '''CGI Response Output formatter
$Id: BaseResponse.py,v 1.12 2002/01/02 15:56:04 andreasjung Exp $''' $Id: BaseResponse.py,v 1.13 2002/06/22 14:02:41 tseaver Exp $'''
__version__='$Revision: 1.12 $'[11:-2] __version__='$Revision: 1.13 $'[11:-2]
import types, sys import types, sys
from types import StringType, InstanceType from types import StringType, InstanceType
...@@ -33,17 +33,19 @@ class BaseResponse: ...@@ -33,17 +33,19 @@ class BaseResponse:
def __init__(self, stdout, stderr, def __init__(self, stdout, stderr,
body='', headers=None, status=None, cookies=None): body='', headers=None, status=None, cookies=None):
self.stdout=stdout self.stdout = stdout
self.stderr=stderr self.stderr = stderr
self.body=body self.body = body
if headers is None: headers={} if headers is None:
self.headers=headers headers={}
self.status=status self.headers = headers
if cookies is None: cookies={} self.status = status
self.cookies=cookies if cookies is None:
cookies={}
self.cookies = cookies
def setStatus(self, status, reason=None): def setStatus(self, status, reason=None):
self.status=status self.status = status
def setHeader(self, name, value): def setHeader(self, name, value):
self.headers[name]=value self.headers[name]=value
...@@ -55,7 +57,7 @@ class BaseResponse: ...@@ -55,7 +57,7 @@ class BaseResponse:
self.stdout.write(str(self)) self.stdout.write(str(self))
def setBody(self, body): def setBody(self, body):
self.body=body self.body = body
def getStatus(self): def getStatus(self):
'Returns the current HTTP status code as an integer. ' 'Returns the current HTTP status code as an integer. '
...@@ -70,10 +72,11 @@ class BaseResponse: ...@@ -70,10 +72,11 @@ class BaseResponse:
"value". This overwrites any previously set value for the "value". This overwrites any previously set value for the
cookie in the Response object. cookie in the Response object.
''' '''
cookies=self.cookies cookies = self.cookies
if cookies.has_key(name): if cookies.has_key(name):
cookie=cookies[name] cookie = cookies[name]
else: cookie=cookies[name]={} else:
cookie = cookies[name] = {}
for k, v in kw.items(): for k, v in kw.items():
cookie[k]=v cookie[k]=v
cookie['value']=value cookie['value']=value
...@@ -104,7 +107,8 @@ class BaseResponse: ...@@ -104,7 +107,8 @@ class BaseResponse:
def __repr__(self): def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, `self.body`) return '%s(%s)' % (self.__class__.__name__, `self.body`)
def flush(self): pass def flush(self):
pass
def write(self,data): def write(self,data):
"""\ """\
...@@ -121,7 +125,7 @@ class BaseResponse: ...@@ -121,7 +125,7 @@ class BaseResponse:
after beginning stream-oriented output. after beginning stream-oriented output.
""" """
self.body=self.body+data self.body = self.body+data
def exception(self, fatal=0, info=None): def exception(self, fatal=0, info=None):
"""Handle an exception. """Handle an exception.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment