예제 #1
0
 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()
예제 #2
0
 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