mirror of
https://github.com/sprockets/sprockets.mixins.mediatype.git
synced 2024-12-29 11:17:10 +00:00
Rename module from media_type -> mediatype.
The github repository is still media_type but I'm okay with that for the time being.
This commit is contained in:
parent
97a7cf76ea
commit
ba9fd2a7ff
4 changed files with 10 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
API Documentation
|
||||
=================
|
||||
.. currentmodule:: sprockets.mixins.media_type
|
||||
.. currentmodule:: sprockets.mixins.mediatype
|
||||
|
||||
Content Type Handling
|
||||
---------------------
|
||||
|
|
|
@ -8,7 +8,7 @@ extensions = ['sphinx.ext.autodoc',
|
|||
'sphinxcontrib.autohttp.tornado']
|
||||
source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
project = 'sprockets.mixins.media_type'
|
||||
project = 'sprockets.mixins.mediatype'
|
||||
copyright = '2015, AWeber Communications'
|
||||
release = __version__
|
||||
version = '.'.join(release.split('.')[0:1])
|
||||
|
|
16
examples.py
16
examples.py
|
@ -2,12 +2,12 @@ import json
|
|||
import logging
|
||||
import signal
|
||||
|
||||
from sprockets.mixins import media_type
|
||||
from sprockets.mixins import mediatype
|
||||
from tornado import ioloop, web
|
||||
import msgpack
|
||||
|
||||
|
||||
class SimpleHandler(media_type.ContentMixin, web.RequestHandler):
|
||||
class SimpleHandler(mediatype.ContentMixin, web.RequestHandler):
|
||||
|
||||
def post(self):
|
||||
body = self.get_request_body()
|
||||
|
@ -18,12 +18,12 @@ class SimpleHandler(media_type.ContentMixin, web.RequestHandler):
|
|||
|
||||
def make_application(**settings):
|
||||
application = web.Application([web.url(r'/', SimpleHandler)], **settings)
|
||||
media_type.set_default_content_type(application, 'application/json',
|
||||
encoding='utf-8')
|
||||
media_type.add_binary_content_type(application, 'application/msgpack',
|
||||
msgpack.packb, msgpack.unpackb)
|
||||
media_type.add_text_content_type(application, 'application/json', 'utf-8',
|
||||
json.dumps, json.loads)
|
||||
mediatype.set_default_content_type(application, 'application/json',
|
||||
encoding='utf-8')
|
||||
mediatype.add_binary_content_type(application, 'application/msgpack',
|
||||
msgpack.packb, msgpack.unpackb)
|
||||
mediatype.add_text_content_type(application, 'application/json', 'utf-8',
|
||||
json.dumps, json.loads)
|
||||
return application
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue