summaryrefslogtreecommitdiff
path: root/lib/commands.py
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-08-17 19:00:42 +0200
committerSanto Cariotti <sancn@live.com>2017-08-17 19:00:42 +0200
commit46e20dca5d9ac795636de326546db21186281e06 (patch)
treecaefc01719de0597d6e51996d64b24e7e05220aa /lib/commands.py
parent6b4a38518e342f02d1d2c665bae8eaa47bba147e (diff)
fixed code style
Diffstat (limited to 'lib/commands.py')
-rw-r--r--lib/commands.py15
1 files changed, 8 insertions, 7 deletions
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')