Commit bddaee85 authored by Alexander Hiam's avatar Alexander Hiam

don't pass 'allow_no_value' to SafeConfigParser if Python < 2.7

parent cf3cd8be
#!/usr/bin/python #!/usr/bin/python
import cherrypy, pronterface, re, ConfigParser, threading import cherrypy, pronterface, re, ConfigParser, threading, sys
import os.path import os.path
users = {} users = {}
...@@ -233,7 +233,11 @@ class XMLstatus(object): ...@@ -233,7 +233,11 @@ class XMLstatus(object):
class WebInterface(object): class WebInterface(object):
def __init__(self, pface): 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') config.read('auth.config')
users[config.get("user", "user")] = config.get("user", "pass") users[config.get("user", "user")] = config.get("user", "pass")
self.pface = pface self.pface = pface
...@@ -369,4 +373,4 @@ def StartWebInterfaceThread(webInterface): ...@@ -369,4 +373,4 @@ def StartWebInterfaceThread(webInterface):
if __name__ == '__main__': if __name__ == '__main__':
cherrypy.config.update("http.config") cherrypy.config.update("http.config")
cherrypy.quickstart(WebInterfaceStub()) cherrypy.quickstart(WebInterfaceStub())
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment