From edc11057e99ce2d69421f09fc5b6d94ca05b524c Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 29 Sep 2019 19:17:49 +0200 Subject: Add function for removing an article --- db.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'db.py') diff --git a/db.py b/db.py index 3fc7c6f..cb280d8 100644 --- a/db.py +++ b/db.py @@ -99,3 +99,12 @@ def bookmarks(path): for name in files: bookmarks.append(bookmark(path / Path(name))) return bookmarks + + +def remove(path): + path = Path(path) + try: + os.remove(path) + logging.info("{} removed".format(path.name)) + except FileNotFoundError: + logging.warning("{} doesn't exist!".format(path.name)) -- cgit v1.2.1