Permalink
Browse files

* call __handle__logout on 'exit' command.

*  made __handle__logout output reflect authentication state
  • Loading branch information...
1 parent 3acd2b6 commit 4b624a049d5c6e6d06a19dbe813ff4c82e9737fc @mbdriscoll mbdriscoll committed Mar 20, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 console.py
View
@@ -96,16 +96,25 @@ def __handle__login(args):
assert is_logged_in()
def __handle__logout(args=[]):
+ # remember if the user was logged in for cosmetic reasons
+ was_logged_in = is_logged_in()
+
+ # clear auth state regardless
ACCESS_TOKEN = EXPIRES = NAME = None
try:
fp = open(tokenfile, 'w')
fp.close()
except IOError:
pass
- print "Successfully logged out"
+ if was_logged_in:
+ print "Successfully logged out."
+ else:
+ print "Not logged in."
def __handle__exit(args=[]):
+ if is_logged_in():
+ __handle__logout()
print "Bye!"
raise SystemExit

0 comments on commit 4b624a0

Please sign in to comment.