From 278144a911cf07a3a9abd79adf304a21dce915d1 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 11 Dec 2017 15:43:35 +0100 Subject: [PATCH] cleanup extending passwd.dat --- networkconfig.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/networkconfig.py b/networkconfig.py index f70ff06..a8aae76 100644 --- a/networkconfig.py +++ b/networkconfig.py @@ -106,14 +106,13 @@ def handle_configure(client, request):

""" send_response(client, response_footer) try: - with open("passwd.dat", "r") as fo: - ex_data = fo.read() - ex_data = ssid + ";" + password + "\n" + ex_data - with open("passwd.dat", "w") as fo: - fo.write(ex_data) + with open("passwd.dat", "r") as f: + ex_data = f.read() except: - with open("passwd.dat", "w") as fo: - fo.write(ssid + ";" + password + "\n") + ex_data = "" + ex_data = "%s;%s\n" % (ssid, password) + ex_data + with open("passwd.dat", "w") as f: + f.write(ex_data) return True else: response_footer = """