summaryrefslogtreecommitdiff
path: root/pnote/metadata.py
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2024-04-18 16:18:41 +0200
committerLoic Guegan <loic.guegan@mailbox.org>2024-04-18 16:18:41 +0200
commitb36e130286061edf577e85a5d6e9649abd63c93e (patch)
treed9f8b694718d669cd492657aca3c6e54f01ee7db /pnote/metadata.py
parent256a6932c3eef45908c5e6d29552d0f35b76c4e7 (diff)
Debug a support for formatted output
Diffstat (limited to 'pnote/metadata.py')
-rw-r--r--pnote/metadata.py10
1 files changed, 8 insertions, 2 deletions
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()