Code cleanup

pull/100/head
Julien Duponchelle 10 years ago
parent b92e065add
commit 869405738e

@ -85,7 +85,7 @@ class Documentation(object):
self._write_json_schema(f, schema['definitions'][definition]) self._write_json_schema(f, schema['definitions'][definition])
f.write("Body\n+++++++++\n") f.write("Body\n+++++++++\n")
def _write_json_schema_object(self, f, obj, schema): def _write_json_schema_object(self, f, obj):
""" """
obj is current object in JSON schema obj is current object in JSON schema
schema is the whole schema including definitions schema is the whole schema including definitions
@ -126,7 +126,7 @@ class Documentation(object):
<th>Type</th> \ <th>Type</th> \
<th>Description</th> \ <th>Description</th> \
</tr>\n") </tr>\n")
self._write_json_schema_object(f, schema, schema) self._write_json_schema_object(f, schema)
f.write(" </table>\n\n") f.write(" </table>\n\n")

@ -44,6 +44,7 @@ class Response(aiohttp.web.Response):
log.debug(data) log.debug(data)
return super().write(data) return super().write(data)
def json(self, answer):
""" """
Set the response content type to application/json and serialize Set the response content type to application/json and serialize
the content. the content.
@ -51,9 +52,6 @@ class Response(aiohttp.web.Response):
:param anwser The response as a Python object :param anwser The response as a Python object
""" """
def json(self, answer):
"""Pass a Python object and return a JSON as answer"""
self.content_type = "application/json" self.content_type = "application/json"
if hasattr(answer, '__json__'): if hasattr(answer, '__json__'):
answer = answer.__json__() answer = answer.__json__()

Loading…
Cancel
Save