def rebase_path(self, old_path: str, new_path: str): with self._db: for element in StorageBlackList.select(): if old_path in element.path: new_file_path = element.path.replace(old_path, new_path) StorageBlackList.update(path=new_file_path).where( StorageBlackList.id == element.id).execute()
def _init_blacklist(self): """ Init the Storage location list. """ for file in StorageBlackList.select(): self.blacklist_model.append([file.path, file.id]) self.__on_blacklist_selection_changed(None)
def is_blacklisted(path): """ Tests whether a given path is blacklisted. """ if StorageBlackList.select().where(StorageBlackList.path == path).count() > 0: return True else: return False