From f161241e077b4a19e79be6b4b01b8cc26a9a54e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Padilla?= Date: Sun, 5 Jul 2015 16:47:02 -0400 Subject: [PATCH] Fix custom parser example --- docs/api-guide/parsers.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md index c242f878b..d5975abd2 100644 --- a/docs/api-guide/parsers.md +++ b/docs/api-guide/parsers.md @@ -144,17 +144,16 @@ By default this will include the following keys: `view`, `request`, `args`, `kwa The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request. class PlainTextParser(BaseParser): - """ - Plain text parser. - """ - - media_type = 'text/plain' - - def parse(self, stream, media_type=None, parser_context=None): """ - Simply return a string representing the body of the request. + Plain text parser. """ - return stream.read() + media_type = 'text/plain' + + def parse(self, stream, media_type=None, parser_context=None): + """ + Simply return a string representing the body of the request. + """ + return stream.read() ---