def dumps(self, data): # don't serialize strings if isinstance(data, (type(''), type(u''))): return data try: return self.renderer.dumps(data) except (ValueError, TypeError) as e: raise SerializationError(data, e)
def loads(self, s): try: return json.loads(s) except (ValueError, TypeError) as e: raise SerializationError(s, e)