From b36e130286061edf577e85a5d6e9649abd63c93e Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 18 Apr 2024 16:18:41 +0200 Subject: Debug a support for formatted output --- pnote/metadata.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pnote/metadata.py') diff --git a/pnote/metadata.py b/pnote/metadata.py index f84ebb0..d7d8b35 100644 --- a/pnote/metadata.py +++ b/pnote/metadata.py @@ -85,12 +85,18 @@ class Metadata: exit(1) return None - def delete(self,subpath): + def delete(self,subpath, ignore_error=False): """ Delete subpath and its associated tags from the metadata. """ cur=self.con.cursor() - subpath_id=self.subpathid(subpath, True) + subpath_id=None + if ignore_error: + subpath_id=self.subpathid(subpath, False) + else: + subpath_id=self.subpathid(subpath, True) + if subpath_id is None: + return cur.execute('DELETE FROM tags WHERE id={}'.format(subpath_id)) cur.execute('DELETE FROM files WHERE id={}'.format(subpath_id)) self.con.commit() -- cgit v1.2.3