Skip to content

Commit

Permalink
Add code required to subclass Api in the Response Formats example
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioherraizs committed Sep 16, 2013
1 parent ccef20c commit b8ca74f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ Another way to accomplish this is to subclass the :class:`~Api` class and
provide your own output functions. ::

class Api(restful.Api):
representations = {
'application/xml': output_xml,
'text/html': output_html,
'text/csv': output_csv,
'application/json': output_json,
}
def __init__(self, *args, **kwargs):
restful.Api.__init__(self, *args, **kwargs)
self.representations = {
'application/xml': output_xml,
'text/html': output_html,
'text/csv': output_csv,
'application/json': output_json,
}

Resource Method Decorators
--------------------------
Expand Down

0 comments on commit b8ca74f

Please sign in to comment.