Mercurial > hg > webaudioevaluationtool
diff python/pythonServer.py @ 2940:8805556c0f42
Potential fix for #235
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 14 Sep 2017 13:10:51 +0100 |
parents | 260efd43fe52 |
children | 24681d53ee7a b09e9b7ef246 |
line wrap: on
line diff
--- a/python/pythonServer.py Tue Sep 12 19:22:21 2017 +0100 +++ b/python/pythonServer.py Thu Sep 14 13:10:51 2017 +0100 @@ -120,6 +120,14 @@ tempKey = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(32)); if (os.path.isfile("saves/save-"+tempKey+".xml") == False): key = tempKey + options = s.path.rsplit('?') + options = options[1].rsplit('&') + for option in options: + optionPair = option.rsplit('=') + if optionPair[0] == "saveFilenamePrefix": + prefix = optionPair[1] + if prefix == None: + prefix = "save" s.send_response(200) s.send_header("Content-type", "application/xml"); s.end_headers() @@ -128,7 +136,7 @@ s.wfile.write(reply) elif sys.version_info[0] == 3: s.wfile.write(bytes(reply, "utf-8")) - file = open("../saves/save-"+key+".xml",'w') + file = open("../saves/"+prefix+"-"+key+".xml",'w') file.write("<waetresult key=\""+key+"\"/>") file.close()