Lines Matching refs:self

10   def __init__(self, dict_):
12 self._dict = dict_
14 self._dict = dict((k.lower(), v) for k, v in dict_.iteritems())
16 def get(self, key, default=None):
17 return self._dict.get(key.lower(), default)
19 def __repr__(self):
20 return repr(self._dict)
22 def __str__(self):
23 return repr(self._dict)
29 def __init__(self, path, host, headers, arguments={}):
30 self.path = path.lstrip('/')
31 self.host = host.rstrip('/')
32 self.headers = RequestHeaders(headers)
33 self.arguments = arguments
42 def __repr__(self):
44 self.path, self.host, self.headers)
46 def __str__(self):
47 return repr(self)
52 def __init__(self):
53 self._buf = []
55 def Append(self, content):
58 self._buf.append(content)
60 def ToString(self):
61 self._Collapse()
62 return self._buf[0]
64 def __str__(self):
65 return self.ToString()
67 def __len__(self):
68 return len(self.ToString())
70 def _Collapse(self):
71 self._buf = [''.join(self._buf)]
76 def __init__(self, content=None, headers=None, status=None):
77 self.content = _ContentBuilder()
79 self.content.Append(content)
80 self.headers = {}
82 self.headers.update(headers)
83 self.status = status
120 def Append(self, content):
123 self.content.append(content)
125 def AddHeader(self, key, value):
128 self.headers[key] = value
130 def AddHeaders(self, headers):
133 self.headers.update(headers)
135 def SetStatus(self, status):
136 self.status = status
138 def GetRedirect(self):
139 if self.headers.get('Location') is None:
141 return (self.headers.get('Location'), self.status == 301)
143 def IsNotFound(self):
144 return self.status == 404
146 def __eq__(self, other):
147 return (isinstance(other, self.__class__) and
148 str(other.content) == str(self.content) and
149 other.headers == self.headers and
150 other.status == self.status)
152 def __ne__(self, other):
153 return not (self == other)
155 def __repr__(self):
157 len(self.content), self.status, self.headers)
159 def __str__(self):
160 return repr(self)
163 def __init__(self, request):
164 self._request = request
166 def Get(self):