1
0
mirror of https://github.com/pypiserver/pypiserver synced 2024-11-09 16:45:51 +01:00

upgrade bottle to 0.11.6

This commit is contained in:
Ralf Schmitt 2013-02-14 23:11:01 +01:00
parent bc9149ec32
commit 0db743cc59

@ -16,7 +16,7 @@ License: MIT (see LICENSE for details)
from __future__ import with_statement from __future__ import with_statement
__author__ = 'Marcel Hellkamp' __author__ = 'Marcel Hellkamp'
__version__ = '0.11.5' __version__ = '0.11.6'
__license__ = 'MIT' __license__ = 'MIT'
# The gevent server adapter needs to patch some modules before they are imported # The gevent server adapter needs to patch some modules before they are imported
@ -567,7 +567,8 @@ class Bottle(object):
for name, value in headerlist: rs.add_header(name, value) for name, value in headerlist: rs.add_header(name, value)
return rs.body.append return rs.body.append
body = app(request.environ, start_response) body = app(request.environ, start_response)
if body: rs.body = itertools.chain(rs.body, body) if body and rs.body: body = itertools.chain(rs.body, body)
rs.body = body or rs.body
return rs return rs
finally: finally:
request.path_shift(-path_depth) request.path_shift(-path_depth)
@ -1285,7 +1286,7 @@ class BaseResponse(object):
def __init__(self, body='', status=None, **headers): def __init__(self, body='', status=None, **headers):
self._cookies = None self._cookies = None
self._headers = {'Content-Type': [self.default_content_type]} self._headers = {}
self.body = body self.body = body
self.status = status or self.default_status self.status = status or self.default_status
if headers: if headers:
@ -1379,7 +1380,9 @@ class BaseResponse(object):
def headerlist(self): def headerlist(self):
''' WSGI conform list of (header, value) tuples. ''' ''' WSGI conform list of (header, value) tuples. '''
out = [] out = []
headers = self._headers.items() headers = list(self._headers.items())
if 'Content-Type' not in self._headers:
headers.append(('Content-Type', [self.default_content_type]))
if self._status_code in self.bad_headers: if self._status_code in self.bad_headers:
bad_headers = self.bad_headers[self._status_code] bad_headers = self.bad_headers[self._status_code]
headers = [h for h in headers if h[0] not in bad_headers] headers = [h for h in headers if h[0] not in bad_headers]