Forward-port: Alias Dump/Load functions in ganeti.serializer to DumpJson/LoadJson
authorMichael Hanselmann <hansmi@google.com>
Fri, 6 Jun 2008 09:27:49 +0000 (09:27 +0000)
committerMichael Hanselmann <hansmi@google.com>
Fri, 6 Jun 2008 09:27:49 +0000 (09:27 +0000)
The remote API will use JSON for the foreseable future, so it's better
to put the serialization format in the function name. We can still
use another serialization format for Ganeti's core.

Reviewed-by: amishchenko, schreiberal

lib/serializer.py

index d00dbc5..7345c79 100644 (file)
@@ -39,7 +39,7 @@ except TypeError:
 _RE_EOLSP = re.compile('\s+$', re.MULTILINE)
 
 
-def Dump(data):
+def DumpJson(data):
   """Serialize a given object.
 
   """
@@ -53,8 +53,12 @@ def Dump(data):
   return txt
 
 
-def Load(txt):
+def LoadJson(txt):
   """Unserialize data from a string.
 
   """
   return simplejson.loads(txt)
+
+
+Dump = DumpJson
+Load = LoadJson