Merge pull request #236 from alexanderhiam/experimental

webinterface.py compatibility with Python 2.6
master
kliment 2012-06-13 09:23:22 -07:00
commit b5dbecc8ac
1 changed files with 7 additions and 3 deletions

View File

@ -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())
cherrypy.quickstart(WebInterfaceStub())