OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, mask=None, skip=False, **kwargs) |
def | parse (self, mask) |
def | clean (self, mask) |
def | apply (self, data) |
def | filter_data (self, data) |
def | __str__ (self) |
Data Fields | |
skip | |
Hold a parsed mask. :param str|dict|Mask mask: A mask, parsed or not :param bool skip: If ``True``, missing fields won't appear in result
def __init__ | ( | self, | |
mask = None , |
|||
skip = False , |
|||
** | kwargs | ||
) |
def __str__ | ( | self | ) |
def apply | ( | self, | |
data | |||
) |
Apply a fields mask to the data. :param data: The data or model to apply mask on :raises MaskError: when unable to apply the mask
def clean | ( | self, | |
mask | |||
) |
Remove unnecessary characters
def filter_data | ( | self, | |
data | |||
) |
Handle the data filtering given a parsed mask :param dict data: the raw data to filter :param list mask: a parsed mask to filter against :param bool skip: whether or not to skip missing fields
def parse | ( | self, | |
mask | |||
) |
Parse a fields mask. Expect something in the form:: {field,nested{nested_field,another},last} External brackets are optionals so it can also be written:: field,nested{nested_field,another},last All extras characters will be ignored. :param str mask: the mask string to parse :raises ParseError: when a mask is unparseable/invalid
skip |