/[glsr]/trunk/harmonious/_baseresponse.py
Gentoo

Contents of /trunk/harmonious/_baseresponse.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (show annotations) (download) (as text)
Thu Jun 16 00:41:45 2005 UTC (11 years, 2 months ago) by port001
File MIME type: text/x-python
File size: 1033 byte(s)
Convert Header to Id
1 __id__ = '$Id$'
2 __version__ = '$Revision: $'
3 __modulename__ = 'BaseResponse'
4
5 class ProgrammingError(Exception): pass
6
7 class BaseResponse:
8
9 def __init__(self):
10
11 if hasattr(self, 'init'):
12
13 self.init()
14 else:
15
16 raise ProgrammingError('Malformed derived class of BaseResponse: \'init\' method undeclared')
17
18 def add_header(self, htype, value):
19
20 if self._headers.has_key(htype):
21
22 return
23
24 self._headers[htype] = value
25
26 def remove_header(self, htype):
27
28 if self._headers.has_key(htype):
29
30 self._headers.pop(htype)
31
32 def update_header(self, htype, value):
33
34 if self._headers.has_key(htype):
35
36 self._headers[htype] = value
37
38 def append_body(self, text):
39
40 self._body = "%s%s" % (self._body, text)
41
42 def get_body(self):
43
44 return self._body
45
46 def get_headers(self):
47
48 return self._headers
49
50 def set_body(self, txt):
51
52 self._body = txt
53
54 def clear_body(self):
55
56 self._body = ''

Properties

Name Value
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.20