diff options
author | Santo Cariotti <sancn@live.com> | 2017-08-17 19:00:42 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-08-17 19:00:42 +0200 |
commit | 46e20dca5d9ac795636de326546db21186281e06 (patch) | |
tree | caefc01719de0597d6e51996d64b24e7e05220aa /lib | |
parent | 6b4a38518e342f02d1d2c665bae8eaa47bba147e (diff) |
fixed code style
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.py | 2 | ||||
-rw-r--r-- | lib/commands.py | 15 |
2 files changed, 9 insertions, 8 deletions
@@ -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') |