def _execute_file_copy_flow(self): """Execute file copy flow if needed""" if hasattr(self, '_documentable_obj') and self._documentable_obj: documentable_obj = self._get_documentable_obj() postfix = self._build_file_name_postfix(documentable_obj) folder_id = self._get_folder(documentable_obj) file_id = self.link from ggrc.gdrive.file_actions import process_gdrive_file response = process_gdrive_file(folder_id, file_id, postfix, separator=Document.FILE_NAME_SEPARATOR, is_uploaded=self.is_uploaded) self._update_fields(response) self._build_relationship(documentable_obj) self._documentable_obj = None
def exec_gdrive_file_copy_flow(self, parent): """Execute google gdrive file copy flow Build file name, destination folder and copy file to that folder. After coping fills evidence object fields with new gdrive URL """ postfix = self._build_file_name_postfix(parent) folder_id = self._get_folder(parent) file_id = self.source_gdrive_id from ggrc.gdrive.file_actions import process_gdrive_file response = process_gdrive_file(file_id, folder_id, postfix, separator=Evidence.FILE_NAME_SEPARATOR, is_uploaded=self.is_uploaded) self._update_fields(response)
def exec_gdrive_file_copy_flow(self, documentable_obj): """Execute google gdrive file copy flow Build file name, destination folder and copy file to that folder. After coping fills document object fields with new gdrive URL """ postfix = self._build_file_name_postfix(documentable_obj) folder_id = self._get_folder(documentable_obj) file_id = self.source_gdrive_id from ggrc.gdrive.file_actions import process_gdrive_file response = process_gdrive_file(folder_id, file_id, postfix, separator=Document.FILE_NAME_SEPARATOR, is_uploaded=self.is_uploaded) self._update_fields(response)
def exec_gdrive_file_copy_flow(self): """Execute google gdrive file copy flow Build file name, destination folder and copy file to that folder. After coping fills evidence object fields with new gdrive URL """ if self.is_with_parent_obj() and \ self.kind == Evidence.FILE and \ self.source_gdrive_id: parent = self._get_parent_obj() folder_id = self._get_folder(parent) file_id = self.source_gdrive_id from ggrc.gdrive.file_actions import process_gdrive_file response = process_gdrive_file(file_id, folder_id, is_uploaded=self.is_uploaded) self._update_fields(response, parent)