OpenQuizz
Une application de gestion des contenus pédagogiques
TaggedJSONSerializer Class Reference
Inheritance diagram for TaggedJSONSerializer:
Collaboration diagram for TaggedJSONSerializer:

Public Member Functions

def __init__ (self)
 
def register (self, tag_class, force=False, index=None)
 
def tag (self, value)
 
def untag (self, value)
 
def dumps (self, value)
 
def loads (self, value)
 

Data Fields

 tags
 
 order
 

Static Public Attributes

 default_tags
 

Detailed Description

Serializer that uses a tag system to compactly represent objects that
are not JSON types. Passed as the intermediate serializer to
:class:`itsdangerous.Serializer`.

The following extra types are supported:

* :class:`dict`
* :class:`tuple`
* :class:`bytes`
* :class:`~flask.Markup`
* :class:`~uuid.UUID`
* :class:`~datetime.datetime`

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Member Function Documentation

◆ dumps()

def dumps (   self,
  value 
)
Tag the value and dump it to a compact JSON string.

◆ loads()

def loads (   self,
  value 
)
Load data from a JSON string and deserialized any tagged objects.

◆ register()

def register (   self,
  tag_class,
  force = False,
  index = None 
)
Register a new tag with this serializer.

:param tag_class: tag class to register. Will be instantiated with this
    serializer instance.
:param force: overwrite an existing tag. If false (default), a
    :exc:`KeyError` is raised.
:param index: index to insert the new tag in the tag order. Useful when
    the new tag is a special case of an existing tag. If ``None``
    (default), the tag is appended to the end of the order.

:raise KeyError: if the tag key is already registered and ``force`` is
    not true.

◆ tag()

def tag (   self,
  value 
)
Convert a value to a tagged representation if necessary.

◆ untag()

def untag (   self,
  value 
)
Convert a tagged representation back to the original type.

Field Documentation

◆ default_tags

default_tags
static

◆ order

order

◆ tags

tags

The documentation for this class was generated from the following file: