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

Public Member Functions

def __init__ (self, default=None, attribute=None)
 
def format (self, value)
 
def output (self, key, obj)
 

Data Fields

 attribute
 
 default
 

Detailed Description

Raw provides a base field class from which others should extend. It
applies no formatting by default, and should only be used in cases where
data does not need to be formatted before being serialized. Fields should
throw a :class:`MarshallingException` in case of parsing problem.

:param default: The default value for the field, if no value is
    specified.
:param attribute: If the public facing value differs from the internal
    value, use this to retrieve a different attribute from the response
    than the publicly named value.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  default = None,
  attribute = None 
)

Member Function Documentation

◆ format()

def format (   self,
  value 
)
Formats a field's value. No-op by default - field classes that
modify how the value of existing object keys should be presented should
override this and apply the appropriate formatting.

:param value: The value to format
:exception MarshallingException: In case of formatting problem

Ex::

    class TitleCase(Raw):
def format(self, value):
    return unicode(value).title()

Reimplemented in Fixed, DateTime, Arbitrary, Float, Boolean, Integer, String, and List.

◆ output()

def output (   self,
  key,
  obj 
)
Pulls the value for the given key from the object, applies the
field's formatting and returns the result. If the key is not found
in the object, returns the default value. Field classes that create
values which do not require the existence of the key in the object
should override this and return the desired value.

:exception MarshallingException: In case of formatting problem

Reimplemented in Url, FormattedString, Nested, and List.

Field Documentation

◆ attribute

attribute

◆ default

default

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