def _as_json(context): try: return json.dumps(context) except TypeError: logging.warning( "unable to json-encode api response. Was the data not serialized?") return json.dumps(serialize_func(context))
def as_json(context): return json.dumps(serialize_func(context))
def serialize(self, *args, **kwargs): return serialize_func(*args, **kwargs)