def _get_protocol(self): res = [] for cls in itersubclasses(AbstractTask): if not cls._synchronize_type: cls_info = (cls._key, cls._name) res.append(cls_info) return res
def _get_method(self): res = [] for cls in itersubclasses(AbstractTask): if cls._synchronize_type: cls_info = (cls._key + '_' + cls._synchronize_type, cls._name + ' ' + cls._synchronize_type) res.append(cls_info) return res
def run(self): for cls in itersubclasses(AbstractTask): if cls._synchronize_type and \ cls._key + '_' + cls._synchronize_type == self.method: method_class = cls config = { 'host': self.location_id.address, 'user': self.location_id.login, 'pwd': self.location_id.password, 'port': self.location_id.port, 'allow_dir_creation': False, 'file_name': self.filename, 'path': self.filepath, 'attachment_ids': self.attachment_ids, 'task': self, 'move_path': self.move_path, 'delete_file': self.delete_file, 'move_file': self.move_file, } conn = method_class(self.env, config) conn.run()