Exemplo n.º 1
0
 def to_python(self, value):
     if value is None:
         return None
     if isinstance(value, dict):
         return value
     try:
         return json.loads(value)
     except ValueError, e:
         raise ValidationError(e)
Exemplo n.º 2
0
 def to_python(self, value):
     if value is None:
         return None
     if isinstance(value, dict):
         return value
     try:
         return json.loads(value)
     except ValueError, e:
         raise ValidationError(e)
Exemplo n.º 3
0
def deserialize(workspace, data, oid, **options):
    """
    Load a JSON object string as a GitModel instance.

    model: the model class representing the data

    data: a valid JSON string

    options: additional options to pass to json.loads()
    """
    data = json.loads(data, **options)
    return python.deserialize(workspace, data, oid)