Skip to content

Commit

Permalink
Merge tag 'v0.7.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaiarocci committed May 24, 2017
2 parents ab1c6c0 + 5679331 commit a21b724
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Patches and Contributions
- Stanislav Filin
- Stanislav Heller
- Stratos Gerakakis
- Sybren A. Stüvel
- Taylor Brown
- Thomas Sileo
- Tim Jacobi
Expand Down
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ Breaking Changes
Stable
------

Version 0.7.4
~~~~~~~~~~~~~

Released on 24 May, 2017

- Fix: ``post_internal`` fails when using ``URL_PREFIX`` or ``API_VERSION``.
Closes #810.

Version 0.7.3
~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion eve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"""

__version__ = '0.7.3'
__version__ = '0.7.4'

# RFC 1123 (ex RFC 822)
DATE_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
Expand Down
2 changes: 1 addition & 1 deletion eve/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def auth_field_and_value(resource):
.. versionadded:: 0.3
"""
if '|resource' in request.endpoint:
if request.endpoint and '|resource' in request.endpoint:
# We are on a resource endpoint and need to check against
# `public_methods`
public_method_list_to_check = 'public_methods'
Expand Down
2 changes: 1 addition & 1 deletion eve/methods/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ def resource_link():
"""
path = request.path.strip('/')

if '|item' in request.endpoint:
if request.endpoint and '|item' in request.endpoint:
path = path[:path.rfind('/')]

def strip_prefix(hit):
Expand Down
23 changes: 23 additions & 0 deletions eve/tests/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,29 @@ def test_api_prefix(self):
r = self.test_prefix.get('/prefix/contacts/')
self.assert200(r.status_code)

r = self.test_prefix.post('/prefix/contacts/', data='{}',
content_type='application/json')
self.assert201(r.status_code)

def test_api_prefix_post_internal(self):
# https://github.com/pyeve/eve/issues/810
from eve.methods.post import post_internal

settings_file = os.path.join(self.this_directory, 'test_prefix.py')
self.app = Eve(settings=settings_file)
self.test_prefix = self.app.test_client()

# This works fine
with self.app.test_request_context(
method='POST', path='/prefix/contacts'):
_, _, _, status_code, _ = post_internal('contacts', {})
self.assert201(status_code)

# This fails unless #810 is fixed
with self.app.test_request_context():
_, _, _, status_code, _ = post_internal('contacts', {})
self.assert201(status_code)

def test_api_prefix_version(self):
settings_file = os.path.join(self.this_directory,
'test_prefix_version.py')
Expand Down
1 change: 1 addition & 0 deletions eve/tests/test_prefix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

RESOURCE_METHODS = ['GET', 'POST']
URL_PREFIX = 'prefix'
DOMAIN = {'contacts': {}}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

setup(
name='Eve',
version='0.7.3',
version='0.7.4',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author='Nicola Iarocci',
Expand Down

0 comments on commit a21b724

Please sign in to comment.