summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-08-22 09:04:50 +0200
committerSanto Cariotti <sancn@live.com>2017-08-22 09:04:50 +0200
commit6d987df8cd743bd16a4740a8d1f64fd6fa0e1c74 (patch)
tree78add1c34428e7d51f15bbe7b1b1ffac5a407818
parent7d8a51880e9e06fb79cc8d728382b4253246d17c (diff)
check username from a file
-rw-r--r--lib/app.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/app.py b/lib/app.py
index f2c151d..2a8a14e 100644
--- a/lib/app.py
+++ b/lib/app.py
@@ -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()