Skip to content

Commit 177cc0a

Browse files
Merge pull request #739 from timothycrosley/develop
2.4.3 Release
2 parents 5b5a4d2 + 78afab0 commit 177cc0a

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.4.2
2+
current_version = 2.4.3
33

44
[bumpversion:file:.env]
55

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111

1212
export PROJECT_NAME=$OPEN_PROJECT_NAME
1313
export PROJECT_DIR="$PWD"
14-
export PROJECT_VERSION="2.4.2"
14+
export PROJECT_VERSION="2.4.3"
1515

1616
if [ ! -d "venv" ]; then
1717
if ! hash pyvenv 2>/dev/null; then

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Ideally, within a virtual environment.
1313
Changelog
1414
=========
1515

16+
### 2.4.3 [hotfix] - March 17, 2019
17+
- Fix issue #737 - latest hug release breaks meinheld worker setup
18+
1619
### 2.4.2 - March 16, 2019
1720
- Python 3.7 support improvements
1821
- No longer test against Python 3.4 - aimed for full deprecation in Hug 3.0.0

hug/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"""
2222
from __future__ import absolute_import
2323

24-
current = "2.4.2"
24+
current = "2.4.3"

hug/input_format.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,13 @@ def urlencoded(body, charset='ascii', **kwargs):
6868

6969

7070
@content_type('multipart/form-data')
71-
def multipart(body, **header_params):
71+
def multipart(body, content_length=0, **header_params):
7272
"""Converts multipart form data into native Python objects"""
73+
header_params.setdefault('CONTENT-LENGTH', content_length)
7374
if header_params and 'boundary' in header_params:
7475
if type(header_params['boundary']) is str:
7576
header_params['boundary'] = header_params['boundary'].encode()
7677

77-
body_content_length = getattr(body, 'content_length', None)
78-
if body_content_length:
79-
header_params['CONTENT-LENGTH'] = body_content_length
80-
8178
form = parse_multipart((body.stream if hasattr(body, 'stream') else body), header_params)
8279
for key, value in form.items():
8380
if type(value) is list and len(value) is 1:

hug/interface.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,10 @@ def gather_parameters(self, request, response, context, api_version=None, **inpu
604604

605605
if self.parse_body and request.content_length:
606606
body = request.stream
607-
body.content_length = request.content_length
608607
content_type, content_params = parse_content_type(request.content_type)
609608
body_formatter = body and self.inputs.get(content_type, self.api.http.input_format(content_type))
610609
if body_formatter:
611-
body = body_formatter(body, **content_params)
610+
body = body_formatter(body, content_length=request.content_length, **content_params)
612611
if 'body' in self.all_parameters:
613612
input_parameters['body'] = body
614613
if isinstance(body, dict):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def list_modules(dirname):
8686

8787
setup(
8888
name='hug',
89-
version='2.4.2',
89+
version='2.4.3',
9090
description='A Python framework that makes developing APIs '
9191
'as simple as possible, but no simpler.',
9292
long_description=long_description,

tests/test_decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ def my_method():
662662
def test_input_format():
663663
"""Test to ensure it's possible to quickly change the default hug output format"""
664664
old_format = api.http.input_format('application/json')
665-
api.http.set_input_format('application/json', lambda a: {'no': 'relation'})
665+
api.http.set_input_format('application/json', lambda a, **headers: {'no': 'relation'})
666666

667667
@hug.get()
668668
def hello(body):
@@ -682,7 +682,7 @@ def hello2(body):
682682
@pytest.mark.skipif(sys.platform == 'win32', reason='Currently failing on Windows build')
683683
def test_specific_input_format():
684684
"""Test to ensure the input formatter can be specified"""
685-
@hug.get(inputs={'application/json': lambda a: 'formatted'})
685+
@hug.get(inputs={'application/json': lambda a, **headers: 'formatted'})
686686
def hello(body):
687687
return body
688688

0 commit comments

Comments
 (0)