comparison bitten/master.py @ 873:4b6ca8cfd8c6 0.6.x

0.6dev: Merged [950] from trunk.
author osimons
date Tue, 19 Oct 2010 20:56:53 +0000
parents 8df9bc903edb
children
comparison
equal deleted inserted replaced
871:0a59d3e71870 873:4b6ca8cfd8c6
141 141
142 # Internal methods 142 # Internal methods
143 143
144 def _send_response(self, req, code=200, body='', headers=None): 144 def _send_response(self, req, code=200, body='', headers=None):
145 """ Formats and sends the response, raising ``RequestDone``. """ 145 """ Formats and sends the response, raising ``RequestDone``. """
146 if isinstance(body, unicode):
147 body = body.encode('utf-8')
146 req.send_response(code) 148 req.send_response(code)
147 headers = headers or {} 149 headers = headers or {}
148 headers.setdefault('Content-Length', len(body)) 150 headers.setdefault('Content-Length', len(body))
149 for header in headers: 151 for header in headers:
150 req.send_header(header, headers[header]) 152 req.send_header(header, headers[header])
Copyright (C) 2012-2017 Edgewall Software