diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-04-02 16:38:59 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-04-02 16:38:59 +0000 |
commit | 0234c46244689bd864dcadb93844612b413ed1f8 (patch) | |
tree | 081ea2f2e9949a7e8725835cda53ca935f998c17 /h-client/hlibrary.py | |
parent | 24349e9580e1b22f5f114c5af91cbf534aaf47af (diff) |
h-client: improved the way errors are shown
Diffstat (limited to 'h-client/hlibrary.py')
-rw-r--r-- | h-client/hlibrary.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 79679b7..ae27316 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -421,8 +421,18 @@ class Client: #log in def login(self, username, password): self.request.setPost({'username' : username, 'password' : password}) - self.request.perform('users/login/en') + result = self.request.perform('users/login/en') self.request.setPost(None) + if result: + if self.isLogged(): + return True + else: + self.errors.append("wrong username or password") + else: + self.errors.append("unable to connect to server") + return -1 + + return False #log out def logout(self): @@ -450,13 +460,13 @@ class Client: else: self._status = False self.errors.append("unable to connect to server") - return False + return -1 #return True if the user is logged, else return False def isLogged(self): info = self.getUserInfo() - if info != False: + if info != -1: if info['status'] == 'logged': return True |