Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/HH-67237' into EXP-20474
Browse files Browse the repository at this point in the history
  • Loading branch information
HH ReleaseBot committed Mar 10, 2017
2 parents d1b9a35 + 1d5d2d2 commit eccf9b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
19 changes: 14 additions & 5 deletions .travis.yml
Expand Up @@ -2,52 +2,61 @@ language: python
matrix:
include:
- os: linux
dist: trusty
python: "2.7"
env: TORNADO_VERSION=HH ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "2.7"
env: TORNADO_VERSION=HH ; WITH_RAVEN=0
- os: linux
dist: trusty
python: "2.7"
env: TORNADO_VERSION=3.2.2 ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.3"
env: TORNADO_VERSION=HH ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.3"
env: TORNADO_VERSION=HH ; WITH_RAVEN=0
- os: linux
dist: trusty
python: "3.3"
env: TORNADO_VERSION=3.2.2 ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.4"
env: TORNADO_VERSION=HH ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.4"
env: TORNADO_VERSION=HH ; WITH_RAVEN=0
- os: linux
dist: trusty
python: "3.4"
env: TORNADO_VERSION=3.2.2 ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.5"
env: TORNADO_VERSION=HH ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.5"
env: TORNADO_VERSION=HH ; WITH_RAVEN=0
- os: linux
dist: trusty
python: "3.5"
env: TORNADO_VERSION=3.2.2 ; WITH_RAVEN=1
- os: linux
dist: trusty
python: "3.6"
env: TORNADO_VERSION=HH ; WITH_RAVEN=0
- os: linux
dist: trusty
python: "3.6"
env: TORNADO_VERSION=3.2.2 ; WITH_RAVEN=1
- os: linux
sudo: required
dist: trusty
python: "2.7"
env: TORNADO_VERSION=HH ; WITH_RAVEN=1
- os: osx
osx_image: xcode7.3
language: generic
Expand Down
16 changes: 1 addition & 15 deletions frontik/handler.py
Expand Up @@ -326,21 +326,7 @@ def write_error(self, status_code=500, **kwargs):

headers = getattr(exception, 'headers', None)
override_content = any(getattr(exception, x, None) is not None for x in ('text', 'xml', 'json'))

finish_with_exception = exception is not None and (
199 < status_code < 400 or # raise HTTPError(200) to finish page immediately
override_content
)

if exception is not None and 199 < status_code < 400:
self.log.warning(
'Deprecated write_error behaviour: exception %s raised with 2xx/3xx status_code', exception
)

if finish_with_exception and not isinstance(exception, HTTPError):
self.log.warning(
'Deprecated write_error behaviour: exception %s is not an HTTPError, but overrides content', exception
)
finish_with_exception = isinstance(exception, HTTPError) and override_content

if headers:
for (name, value) in iteritems(headers):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errors.py
Expand Up @@ -9,7 +9,7 @@ class TestHttpError(unittest.TestCase):
def test_raise_200(self):
response = frontik_test_app.get_page('http_error')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'success')
self.assertEqual(response.content, b'<html><title>200: OK</title><body>200: OK</body></html>')

def test_raise_401(self):
response = frontik_test_app.get_page('http_error?code=401')
Expand Down

0 comments on commit eccf9b3

Please sign in to comment.