diff options
Diffstat (limited to 'pnote/metadata.py')
| -rw-r--r-- | pnote/metadata.py | 10 |
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() |
