From 3cda36b562b17587f2c823284c8e9a344c1364bb Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 3 Jan 2018 15:29:38 +0100 Subject: Delete username --- lib/commands.py | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'lib/commands.py') diff --git a/lib/commands.py b/lib/commands.py index b0d07a3..ba16143 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -8,35 +8,7 @@ class Commands(object): """ this function is used for execute a command """ - if what == 'set': - try: - if cmd[1] == 'user' and cmd[2] is not None: #set name for user - if len(cmd[2]) > 10: - raise PersonalError('lunghezza maggiore del consetito. Max 10') - - if len(cmd) > ListCommands.info['set'][1]: - raise PersonalError(GREY + 'set user' + RED + ' accetta 1 parametro') - - - self.user = cmd[2] - with open(co['path'], 'rb') as fin: - listOld = [x.decode('utf-8') for x in fin.readlines()] - del listOld[0] - - with open(co['path'], 'wb') as fout: - fout.write((cmd[2] + '\n').encode('utf-8')) - for i in listOld: - fout.write((i).encode('utf-8')) - del listOld - - print('Ok') - elif cmd[1] is not ListCommands.commands['set']: - raise KeyError - except (IndexError, KeyError) as e: - ListCommands.err(type(e).__name__) - except PersonalError as e: - ListCommands.err('personal', e.value) - elif what == 'get': + if what == 'get': try: if len(cmd) > ListCommands.info['get'][1]: raise PersonalError(GREY + 'get ' + RED + 'accetta 2 parametri') -- cgit v1.2.3-18-g5258