Esempio n. 1
0
 def assertBackAndForth(self, obj):
     """
 Checks that conversion to json and back is idempotent.
 """
     jsonable = thrift2json(obj)
     back = jsonable2thrift(jsonable, type(obj))
     self.assertEquals(obj, back)
 def assertBackAndForth(self, obj):
   """
   Checks that conversion to json and back is idempotent.
   """
   jsonable = thrift2json(obj)
   back = jsonable2thrift(jsonable, type(obj))
   self.assertEquals(obj, back)
Esempio n. 3
0
 def value_to_string(self, obj):
     """
 Used by XML serialization.
 """
     return json.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
Esempio n. 4
0
 def get_db_prep_save(self, value, *args, **kwargs):
     if value is None:
         return None
     jsonable = thrift_util.thrift2json(value)
     return json.dumps(jsonable)
Esempio n. 5
0
 def value_to_string(self, obj):
   """
   Used by XML serialization.
   """
   return json.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
Esempio n. 6
0
 def get_db_prep_save(self, value, *args, **kwargs):
   if value is None: 
     return None
   jsonable = thrift_util.thrift2json(value)
   return json.dumps(jsonable)
Esempio n. 7
0
 def get_db_prep_save(self, value):
   if value is None: 
     return None
   jsonable = thrift_util.thrift2json(value)
   json = simplejson.dumps(jsonable)
   return json