Example #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)
Example #3
0
 def value_to_string(self, obj):
     """
 Used by XML serialization.
 """
     return json.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
Example #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)
Example #5
0
 def value_to_string(self, obj):
   """
   Used by XML serialization.
   """
   return json.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
Example #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)
Example #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