Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed JSendMixin hanging up if auto_finish was disabled

  • Loading branch information...
commit b12e0959fef4858b0f6ff12057e3aa100cd28cb4 1 parent dbd2fd8
Ilya Pafyorov authored
Showing with 6 additions and 0 deletions.
  1. +3 −0  tests/test_tornado_json.py
  2. +3 −0  tornado_json/jsend.py
View
3  tests/test_tornado_json.py
@@ -170,6 +170,9 @@ class MockJSendMixinRH(jsend.JSendMixin):
def write(self, data):
self._buffer = data
+ def finish(self):
+ pass
+
@classmethod
@pytest.fixture(scope="class", autouse=True)
def setup(cls):
View
3  tornado_json/jsend.py
@@ -19,6 +19,7 @@ def success(self, data):
call. If the call returns no data, data should be set to null.
"""
self.write({'status': 'success', 'data': data})
+ self.finish()
def fail(self, data):
"""There was a problem with the data submitted, or some pre-condition
@@ -30,6 +31,7 @@ def fail(self, data):
the response object's keys SHOULD correspond to those POST values.
"""
self.write({'status': 'fail', 'data': data})
+ self.finish()
def error(self, message, data=None, code=None):
"""An error occurred in processing the request, i.e. an exception was
@@ -51,3 +53,4 @@ def error(self, message, data=None, code=None):
if code:
result['code'] = code
self.write(result)
+ self.finish()
Please sign in to comment.
Something went wrong with that request. Please try again.