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

Public Member Functions

def __init__ (self, serializer)
 
def check (self, value)
 
def to_json (self, value)
 
def to_python (self, value)
 
def tag (self, value)
 

Data Fields

 serializer
 

Static Public Attributes

 key
 

Detailed Description

Base class for defining type tags for :class:`TaggedJSONSerializer`.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  serializer 
)
Create a tagger for the given serializer.

Member Function Documentation

◆ check()

def check (   self,
  value 
)
Check if the given value should be tagged by this tag.

Reimplemented in TagDateTime, TagUUID, TagMarkup, TagBytes, PassList, TagTuple, PassDict, and TagDict.

◆ tag()

def tag (   self,
  value 
)
Convert the value to a valid JSON type and add the tag structure
around it.

◆ to_json()

def to_json (   self,
  value 
)
Convert the Python object to an object that is a valid JSON type.
The tag will be added later.

Reimplemented in TagDateTime, TagUUID, TagMarkup, TagBytes, PassList, TagTuple, PassDict, and TagDict.

◆ to_python()

def to_python (   self,
  value 
)
Convert the JSON representation back to the correct type. The tag
will already be removed.

Reimplemented in TagDateTime, TagUUID, TagMarkup, TagBytes, TagTuple, and TagDict.

Field Documentation

◆ key

key
static

◆ serializer

serializer

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