Ticket #5479: response_header.diff

File response_header.diff, 2.5 KB (added by Philippe Raoult, 17 years ago)
  • django/http/__init__.py

     
    274274        return self._headers.has_key(header.lower())
    275275
    276276    __contains__ = has_header
     277   
     278    def items(self):
     279        return self._headers.items()
     280    def get(self, header, alternate):
     281        return self._headers.get(header, alternate)
    277282
    278283    def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None):
    279284        self.cookies[key] = value
  • django/core/handlers/wsgi.py

     
    208208        except KeyError:
    209209            status_text = 'UNKNOWN STATUS CODE'
    210210        status = '%s %s' % (response.status_code, status_text)
    211         response_headers = [(str(k), str(v)) for k, v in response.headers.items()]
     211        response_headers = [(str(k), str(v)) for k, v in response.items()]
    212212        for c in response.cookies.values():
    213213            response_headers.append(('Set-Cookie', str(c.output(header=''))))
    214214        start_response(status, response_headers)
  • django/core/handlers/modpython.py

     
    159159
    160160        # Convert our custom HttpResponse object back into the mod_python req.
    161161        req.content_type = response['Content-Type']
    162         for key, value in response.headers.items():
    163             if key != 'Content-Type':
     162        for key, value in response.items():
     163            if key != 'content-type':
    164164                req.headers_out[str(key)] = str(value)
    165165        for c in response.cookies.values():
    166166            req.headers_out.add('Set-Cookie', c.output(header=''))
  • django/middleware/gzip.py

     
    2020       
    2121        # Avoid gzipping if we've already got a content-encoding or if the
    2222        # content-type is Javascript (silly IE...)
    23         is_js = "javascript" in response.headers.get('Content-Type', '').lower()
     23        is_js = "javascript" in response.get('Content-Type', '').lower()
    2424        if response.has_header('Content-Encoding') or is_js:
    2525            return response
    2626
Back to Top