|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, fields, envelope=None) |
| def | __call__ (self, f) |
Data Fields | |
| fields | |
| envelope | |
A decorator that apply marshalling to the return values of your methods.
>>> from flask_restful import fields, marshal_with
>>> mfields = { 'a': fields.Raw }
>>> @marshal_with(mfields)
... def get():
... return { 'a': 100, 'b': 'foo' }
...
...
>>> get()
OrderedDict([('a', 100)])
>>> @marshal_with(mfields, envelope='data')
... def get():
... return { 'a': 100, 'b': 'foo' }
...
...
>>> get()
OrderedDict([('data', OrderedDict([('a', 100)]))])
see :meth:`flask_restful.marshal`
| def __init__ | ( | self, | |
| fields, | |||
envelope = None |
|||
| ) |
:param fields: a dict of whose keys will make up the final
serialized response output
:param envelope: optional key that will be used to envelop the serialized
response
| def __call__ | ( | self, | |
| f | |||
| ) |
| envelope |
| fields |