def execute(self): file_id = file_info.get_file_name(self.old_file_name) file = File(self.storage_name) file._id = file_id file.persisted_file_name = self.old_file_name file.original_file_name = self.new_file["file_name"] file.content = self.new_file["file_content"] file.replace()
def get_by_id(self, id): from pystatic.domain.aggregates.file.model.file import File result = self._collection.reader.get(ObjectId(id)) file = File(result["info"]["storage_name"]) file._id = str(result["info"]["_id"]) file.content = result["binary_data"] file.original_file_name = result["info"]["original_file_name"] file.persisted_file_name = result["info"]["persisted_file_name"] file.path = result["info"]["path"] return file
def execute(self): file = File(self.storage_name) file.persisted_file_name = self.file_name file.remove_by_path()