From dbce3e4582483af01f55cb2ddca26fb09dbf853a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 28 Jun 2014 15:44:38 +0200 Subject: [Lib] Update bottle.py to version 0.12.7 --- module/lib/bottle.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module') diff --git a/module/lib/bottle.py b/module/lib/bottle.py index 0894d57c2..bcc284c1d 100644 --- a/module/lib/bottle.py +++ b/module/lib/bottle.py @@ -16,7 +16,7 @@ License: MIT (see LICENSE for details) from __future__ import with_statement __author__ = 'Marcel Hellkamp' -__version__ = '0.12.5' +__version__ = '0.12.7' __license__ = 'MIT' # The gevent server adapter needs to patch some modules before they are imported @@ -1115,7 +1115,8 @@ class BaseRequest(object): property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion. ''' - if 'application/json' in self.environ.get('CONTENT_TYPE', ''): + ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0] + if ctype == 'application/json': return json_loads(self._get_body_string()) return None @@ -1226,6 +1227,7 @@ class BaseRequest(object): elif py3k: args['encoding'] = 'utf8' data = cgi.FieldStorage(**args) + self['_cgi.FieldStorage'] = data #http://bugs.python.org/issue18394#msg207958 data = data.list or [] for item in data: if item.filename: @@ -3340,7 +3342,10 @@ class SimpleTemplate(BaseTemplate): @cached_property def code(self): - source = self.source or open(self.filename, 'rb').read() + source = self.source + if not source: + with open(self.filename, 'rb') as f: + source = f.read() try: source, encoding = touni(source), 'utf8' except UnicodeError: -- cgit v1.2.3