Skip to content

Commit

Permalink
body no longer argument passed to method from io_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
hfaran committed Feb 16, 2014
1 parent f557b0a commit 876337a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion demos/helloworld/helloworld/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ class HelloWorldHandler(APIHandler):
}

@io_schema
def get(self, body):
def get(self):
return "Hello world!"
5 changes: 0 additions & 5 deletions docs/using_tornado_json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ validated against the output schema and be written back according to the
``io_schema`` decorator handles all of this so be sure to decorate any
HTTP methods with it.

Also, all HTTP methods **must** have a signature of exactly
``(self, body)`` as that is what ``io_schema`` will call them with (this
is a JSON API after all, so we don't need parameterized methods and only
their JSON body content).

.. code:: python
@io_schema
Expand Down
8 changes: 4 additions & 4 deletions tornado_json/test/test_tornado_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class TerribleHandler(MockRequestHandler):
}

@utils.io_schema
def get(self, body):
def get(self):
return "I am not the handler you are looking for."

@utils.io_schema
def post(self, body):
def post(self):
return "Fission mailed."

class ReasonableHandler(MockRequestHandler):
Expand Down Expand Up @@ -126,11 +126,11 @@ class ReasonableHandler(MockRequestHandler):
}

@utils.io_schema
def get(self, body):
def get(self):
return "I am the handler you are looking for."

@utils.io_schema
def post(self, body):
def post(self):
return "Mail received."

def test_io_schema(self):
Expand Down
2 changes: 1 addition & 1 deletion tornado_json/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _wrapper(self, *args, **kwargs):
input_ = None

# Call the requesthandler method
output = rh_method(self, input_)
output = rh_method(self, *args, **kwargs)

# We wrap output in an object before validating in case
# output is a string (and ergo not a validatable JSON object)
Expand Down

0 comments on commit 876337a

Please sign in to comment.