Subtly prefer add_transcoder in docs.

This commit is contained in:
Dave Shawley 2021-10-01 08:36:25 -04:00
parent 4a0ca5e390
commit 36244966e4
No known key found for this signature in database
GPG key ID: F41A8A99298F8EED

View file

@ -81,10 +81,8 @@ class ContentSettings:
def make_application():
app = web.Application([('/', SomeHandler)])
add_binary_content_type(app, 'application/msgpack',
msgpack.packb, msgpack.unpackb)
add_text_content_type(app, 'application/json', 'utf-8',
json.dumps, json.loads)
add_transcoder(app, transcoders.JSONTranscoder())
add_transcoder(app, transcoders.MsgPackTranscoder())
return app
Of course, that is quite tedious, so use the :class:`.ContentMixin`