move page builder function into Host class

This commit is contained in:
2016-04-28 16:19:38 +02:00
parent 6248882b20
commit fda35d8738
2 changed files with 27 additions and 14 deletions
+22
View File
@@ -277,6 +277,28 @@ class Host:
# (self.name, self.dispstate(), self.dispstats(), ipv4addr, ipv6addr, lastts, self.cver)
def buildhosttable(self):
res = []
res.append('<table id="ntable" class="sortable">')
res.append(ubHost.htmlheaders())
hosts_sorted = Host.hosts.keys()
if len(hosts_sorted):
hosts_sorted.sort()
for h in hosts_sorted:
res.append(Host.hosts[h].htmldisp())
res.append("</table>")
return res
def buildmsgtable(self, msgs):
res = []
le = max(40 - len(Host.hosts), 3)
res.append("<h4>Log of Events</h4>")
for m in msgs[len(msgs)-le:]:
res.append("%s<BR>" % m)
return res
# create fake "unbound objects", remove in Python 3.0
ubHost = Host(None)