From bddaee859ed987b5a218a0a2b5bed9b8fe847483 Mon Sep 17 00:00:00 2001 From: Alexander Hiam Date: Thu, 7 Jun 2012 00:51:55 -0400 Subject: [PATCH] don't pass 'allow_no_value' to SafeConfigParser if Python < 2.7 --- webinterface.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webinterface.py b/webinterface.py index 66601f1..6ac1ff6 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1,5 +1,5 @@ #!/usr/bin/python -import cherrypy, pronterface, re, ConfigParser, threading +import cherrypy, pronterface, re, ConfigParser, threading, sys import os.path users = {} @@ -233,7 +233,11 @@ class XMLstatus(object): class WebInterface(object): def __init__(self, pface): - config = ConfigParser.SafeConfigParser(allow_no_value=True) + if (sys.version_info[1] > 6): + # 'allow_no_value' wasn't added until 2.7 + config = ConfigParser.SafeConfigParser(allow_no_value=True) + else: + config = ConfigParser.SafeConfigParser() config.read('auth.config') users[config.get("user", "user")] = config.get("user", "pass") self.pface = pface @@ -369,4 +373,4 @@ def StartWebInterfaceThread(webInterface): if __name__ == '__main__': cherrypy.config.update("http.config") - cherrypy.quickstart(WebInterfaceStub()) \ No newline at end of file + cherrypy.quickstart(WebInterfaceStub())