Esempio n. 1
0
 def set_header(self, name, value):
     """ Create a new response header, replacing any previously defined
         headers with the same name. """
     self._headers[_hkey(name)] = [value if isinstance(value, unicode) else str(value)]
Esempio n. 2
0
 def add_header(self, name, value):
     """ Add an additional response header, not removing duplicates. """
     self._headers.setdefault(_hkey(name), []).append(str(value))
Esempio n. 3
0
 def get_header(self, name, default=None):
     """ Return the value of a previously defined header. If there is no
         header with that name, return a default value. """
     return self._headers.get(_hkey(name), [default])[-1]
Esempio n. 4
0
    def __setitem__(self, name, value): self._headers[_hkey(name)] = [str(value)]

    def get_header(self, name, default=None):
Esempio n. 5
0
 def __getitem__(self, name):  return self._headers[_hkey(name)][-1]
 def __setitem__(self, name, value): self._headers[_hkey(name)] = [str(value)]
Esempio n. 6
0
 def __delitem__(self, name):  del self._headers[_hkey(name)]
 def __getitem__(self, name):  return self._headers[_hkey(name)][-1]
Esempio n. 7
0
 def __contains__(self, name): return _hkey(name) in self._headers
 def __delitem__(self, name):  del self._headers[_hkey(name)]