def process_result_value(self, value, dialect): if value is None: return None else: try: # the extra str() call is for databases like postgres that # insist on using buffers for binary data. return load_json(str(value)) except ValueError: try: return load_pickle(str(value)) except ValueError: # Database corrupted? Return raw data return {'dump': str(value)}
def read_pickle(self): """Reads a pickled object from the wrapped file. """ return load_pickle(self.file)