From 6d987df8cd743bd16a4740a8d1f64fd6fa0e1c74 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 22 Aug 2017 09:04:50 +0200 Subject: check username from a file --- lib/app.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') 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() -- cgit v1.2.3-18-g5258