Commit bae6cf0f authored by nextime's avatar nextime

Move getPage in board modules to base class

parent 045c55b8
......@@ -52,7 +52,11 @@ class BaseBoard(object):
hasInputs = False
hasPWMs = False
hasRelays = False
pwd=False
user="system"
def requestPage(self, uri):
return wu.getPage(uri, http_user=self.user, http_password=self.pwd)
class BoardAnalog(object):
""" """
......
......@@ -87,11 +87,11 @@ class DMBoard(BaseBoard):
return defer.succeed(True)
def _getBoardConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ajax.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ajax.xml")
def _getIOConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml")
def getAnalogsNames(self):
if not self.analist:
ret = {}
......
......@@ -84,11 +84,12 @@ class DMBoard(BaseBoard):
self.ioXML = xml.parseXMLString(res)
return defer.succeed(True)
def _getBoardConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ajax.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ajax.xml")
def _getIOConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml")
def getAnalogsNames(self):
if not self.analist:
......
......@@ -86,11 +86,11 @@ class DMBoard(BaseBoard):
return defer.succeed(True)
def _getBoardConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ajax.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ajax.xml")
def _getIOConfig(self, *a):
return wu.getPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml", http_user="system", http_password=self.pwd)
return self.requestPage("http://"+self.host+":"+str(self.port)+"/ioconf.xml")
def getAnalogsNames(self):
return self.analist
......
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