summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/app.py2
-rw-r--r--lib/commands.py15
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/app.py b/lib/app.py
index 754c10f..5b0c2c8 100644
--- a/lib/app.py
+++ b/lib/app.py
@@ -1,4 +1,4 @@
-from classes import PersonalError, r, clear, YELLOW, BLACK, GREY
+from classes import r, clear, YELLOW, BLACK, GREY
from commands import Commands
from listcommands import ListCommands
diff --git a/lib/commands.py b/lib/commands.py
index c727f90..bb317e0 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -101,18 +101,19 @@ class Commands(object):
print('nessun todo con questo id')
else:
try:
- msg = self.msgFromId(cmd[1]) #return value of sorted set's rank
+ msg = msgFromId(cmd[1]) #return value of sorted set's rank
r.zrem('todo', msg)
r.decr('idTODO')
print('Ok')
- except:
- print('0')
+ except Exception as e:
+ print(e)
except IndexError:
ListCommands.err('wrong')
except KeyError:
ListCommands.err('keyword')
- def msgFromId(self, value):
- for i, val in enumerate(r.zrange('todo', 0, -1)):
- if i == int(value):
- return val.decode('utf-8')
+
+def msgFromId(value):
+ for i, val in enumerate(r.zrange('todo', 0, -1)):
+ if i == int(value):
+ return val.decode('utf-8')