Package ganeti :: Module serializer
[hide private]
[frames] | no frames]

Module serializer

source code

Serializer abstraction module

This module introduces a simple abstraction over the serialization backend (currently json).

Functions [hide private]
 
DumpJson(data, indent=True)
Serialize a given object.
source code
 
LoadJson(txt)
Unserialize data from a string.
source code
 
Dump(data, indent=True)
Serialize a given object.
source code
 
Load(txt)
Unserialize data from a string.
source code
Variables [hide private]
  _JSON_INDENT = None
  _RE_EOLSP = re.compile('[ \t]+$', re.MULTILINE)

Imports: simplejson, re


Function Details [hide private]

DumpJson(data, indent=True)

source code 

Serialize a given object.

Parameters:
  • data - the data to serialize
  • indent - whether to indent output (depends on simplejson version)
Returns:
the string representation of data

LoadJson(txt)

source code 

Unserialize data from a string.

Parameters:
  • txt - the json-encoded form
Returns:
the original data

Dump(data, indent=True)

source code 

Serialize a given object.

Parameters:
  • data - the data to serialize
  • indent - whether to indent output (depends on simplejson version)
Returns:
the string representation of data

Load(txt)

source code 

Unserialize data from a string.

Parameters:
  • txt - the json-encoded form
Returns:
the original data