summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-07-20 16:36:33 +0200
committerSanto Cariotti <sancn@live.com>2017-07-20 16:36:33 +0200
commitf13d8c416b1bc1a0a7b2c07d2c9913ef11f3328f (patch)
tree5f2eaca1021548eb1106ee230488675ac4aac7b0
parente4f41b6b14f06e6edaebfd1fc61937861c4c5b71 (diff)
fixed position of keyword raise
-rw-r--r--lib/commands.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/commands.py b/lib/commands.py
index 9616b8d..0e59c12 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -9,11 +9,14 @@ class Commands(object):
elif what == 'set':
try:
if cmd[1] == 'user' and cmd[2] is not None:
- if len(cmd[2]) > 10: raise PersonalError('lunghezza maggiore del consetito. Max 10')
+ if len(cmd[2]) > 10:
+ raise PersonalError('lunghezza maggiore del consetito. Max 10')
- if userexist(cmd[2]) == True: raise PersonalError('questo nome utente esiste già')
+ if userexist(cmd[2]) == True:
+ raise PersonalError('questo nome utente esiste già')
- if len(cmd) > ListCommands.info['set'][1]: raise PersonalError(Colors.grey + 'set user' + Colors.red + ' accetta 1 parametro')
+ if len(cmd) > ListCommands.info['set'][1]:
+ raise PersonalError(Colors.grey + 'set user' + Colors.red + ' accetta 1 parametro')
if self.user != '': r.zrem('usersname', self.user)
@@ -30,7 +33,8 @@ class Commands(object):
ListCommands.err('personal', e.value)
elif what == 'get':
try:
- if len(cmd) > ListCommands.info['get'][1] and cmd[1] != 'user?': raise PersonalError(Colors.grey + 'get ' + Colors.red + 'accetta 2 parametri')
+ if len(cmd) > ListCommands.info['get'][1] and cmd[1] != 'user?':
+ raise PersonalError(Colors.grey + 'get ' + Colors.red + 'accetta 2 parametri')
if cmd[1] == 'i':
if cmd[2] == 'user':
@@ -45,7 +49,8 @@ class Commands(object):
elif cmd[2] not in ListCommands.commands['get'][1]:
ListCommands.err('keyword')
elif cmd[1] == 'user?':
- if len(cmd) > 3: raise PersonalError(Colors.grey + 'get user?' + Colors.red + ' accetta 1 parametro')
+ if len(cmd) > 3:
+ raise PersonalError(Colors.grey + 'get user?' + Colors.red + ' accetta 1 parametro')
print((lambda x: '0' if x == False else '1')(userexist(cmd[2])))
else:
raise KeyError