From 46e20dca5d9ac795636de326546db21186281e06 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 17 Aug 2017 19:00:42 +0200 Subject: fixed code style --- lib/app.py | 2 +- lib/commands.py | 15 ++++++++------- 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') -- cgit v1.2.3-18-g5258