diff options
author | Santo Cariotti <sancn@live.com> | 2017-08-22 09:04:50 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-08-22 09:04:50 +0200 |
commit | 6d987df8cd743bd16a4740a8d1f64fd6fa0e1c74 (patch) | |
tree | 78add1c34428e7d51f15bbe7b1b1ffac5a407818 /lib | |
parent | 7d8a51880e9e06fb79cc8d728382b4253246d17c (diff) |
check username from a file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.py | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -20,10 +20,13 @@ class Stout(Commands): """ if users exists, return username, else return an empty string """ - if r.get('user') is not None: - return r.get('user').decode('utf-8') #default is a byte - else: - return '' + with open('/tmp/stout', 'rb') as fin: + user = fin.readline() + + if user == '': + return '' + else: + return user.decode('utf-8') def action(self, cmd): """ @@ -68,4 +71,3 @@ if __name__ == '__main__': break app.action(cmd) - r.save() |