def get_data_item(self, data_id): if data.is_file_in_stash(self.get_filename(data_id)): with data.open_data_file_in_stash(self.get_filename(data_id), utils.READ_BINARY_MODE) as data_item: return data_id, data_item.read()
def open_file(self, data_id): with data.open_data_file_in_stash(self.get_filename(data_id), utils.READ_BINARY_MODE) as data_item: data_block = data_item.read() return data_block
def add_file(self, data_id, main_part): with data.open_data_file_in_stash(self.get_filename(data_id), utils.WRITE_BINARY_MODE) as data_item: data_item.write(main_part)
def get_data_item(self, data_id): if data.is_file_in_stash(self.get_filename(data_id)): with data.open_data_file_in_stash( self.get_filename(data_id), utils.READ_BINARY_MODE) as data_item: return data_id, data_item.read()
def add_file(self, data_id, main_part): with data.open_data_file_in_stash( self.get_filename(data_id), utils.WRITE_BINARY_MODE) as data_item: data_item.write(main_part)