Skip to content

Commit

Permalink
Merge pull request #739 from timothycrosley/develop
Browse files Browse the repository at this point in the history
2.4.3 Release
  • Loading branch information
timothycrosley committed Mar 17, 2019
2 parents 5b5a4d2 + 78afab0 commit 177cc0a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.4.2
current_version = 2.4.3

[bumpversion:file:.env]

Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

export PROJECT_NAME=$OPEN_PROJECT_NAME
export PROJECT_DIR="$PWD"
export PROJECT_VERSION="2.4.2"
export PROJECT_VERSION="2.4.3"

if [ ! -d "venv" ]; then
if ! hash pyvenv 2>/dev/null; then
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Ideally, within a virtual environment.
Changelog
=========

### 2.4.3 [hotfix] - March 17, 2019
- Fix issue #737 - latest hug release breaks meinheld worker setup

### 2.4.2 - March 16, 2019
- Python 3.7 support improvements
- No longer test against Python 3.4 - aimed for full deprecation in Hug 3.0.0
Expand Down
2 changes: 1 addition & 1 deletion hug/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"""
from __future__ import absolute_import

current = "2.4.2"
current = "2.4.3"
7 changes: 2 additions & 5 deletions hug/input_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ def urlencoded(body, charset='ascii', **kwargs):


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

body_content_length = getattr(body, 'content_length', None)
if body_content_length:
header_params['CONTENT-LENGTH'] = body_content_length

form = parse_multipart((body.stream if hasattr(body, 'stream') else body), header_params)
for key, value in form.items():
if type(value) is list and len(value) is 1:
Expand Down
3 changes: 1 addition & 2 deletions hug/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,10 @@ def gather_parameters(self, request, response, context, api_version=None, **inpu

if self.parse_body and request.content_length:
body = request.stream
body.content_length = request.content_length
content_type, content_params = parse_content_type(request.content_type)
body_formatter = body and self.inputs.get(content_type, self.api.http.input_format(content_type))
if body_formatter:
body = body_formatter(body, **content_params)
body = body_formatter(body, content_length=request.content_length, **content_params)
if 'body' in self.all_parameters:
input_parameters['body'] = body
if isinstance(body, dict):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def list_modules(dirname):

setup(
name='hug',
version='2.4.2',
version='2.4.3',
description='A Python framework that makes developing APIs '
'as simple as possible, but no simpler.',
long_description=long_description,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def my_method():
def test_input_format():
"""Test to ensure it's possible to quickly change the default hug output format"""
old_format = api.http.input_format('application/json')
api.http.set_input_format('application/json', lambda a: {'no': 'relation'})
api.http.set_input_format('application/json', lambda a, **headers: {'no': 'relation'})

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

Expand Down

0 comments on commit 177cc0a

Please sign in to comment.