def _read_referenced_resources(self, query, id_type): statement = query ret = ReferencedResources() rs = statement.fetchall() cell_des = CellDeserializer(id_type) content_des = ContentDeserializer(id_type) for r in rs: try: v = Reference.deserialize(decode_serialized_value(r[0])) scontent = decode_serialized_value(r[2]) if r[2] else None res = Resource(cell_des.deserialize(decode_serialized_value(r[1])), content_des.deserialize(scontent)) cell_name = v.ref ret[v.block_version][cell_name] = res # logger.debug("Local found: %s/%s" % (str(v.block_version), str(cell_name))) except Exception as e: tb = traceback.format_exc() logger.error("Error while reading resources %s" % str(e)) logger.debug(tb) return ret
def testSerialize(self): serial = self.r.serialize() d = CellDeserializer(BlockCellName) deserialized = d.deserialize(serial) self.assertEquals(self.r, deserialized)