move page builder function into Host class
This commit is contained in:
+22
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user