Keep countries in two columns

This commit is contained in:
simon.kagstrom 2009-11-03 20:21:52 +00:00
parent e83e24f785
commit 5deb489b18
2 changed files with 12 additions and 3 deletions

View File

@ -382,7 +382,11 @@ class Broker(SocketServer.UDPServer):
self.image_dir = image_dir
stats.load(self.stat_data)
stats.generate_html(self.stat_html)
try:
stats.generate_html(self.stat_html)
except:
# Don't care if it fails
pass
def log_connection(self, who, country):
stats.add_connection(who, country)

View File

@ -59,8 +59,13 @@ class HtmlGenerator:
outf.write("<br><br><TABLE border=\"0\" cellpadding=\"0\">\n")
outf.write("<TR><TD colspan=4><H3>Country list</H3></TD></TR>\n")
count = 1
for country, num in sorted_countries:
outf.write("<TR><TD><b>%3d</b></TD><TD>&nbsp;</TD><TD>%s (%d)</TD></TR>\n" % (count, country, num) )
n_countries = len(sorted_countries)
for i in range(0, n_countries / 2):
c1, n1 = sorted_countries[i]
c2, n2 = sorted_countries[i + n_countries / 2]
outf.write("<TR><TD><b>%3d</b></TD><TD>&nbsp;</TD><TD>%s (%d)</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD><b>%3d</b></TD><TD>&nbsp;</TD><TD>%s (%d)</TD></TR>\n" %
(count, c1, n1, count + n_countries / 2, c2, n2) )
count = count + 1
outf.write("</TABLE>\n")
outf.write("</body></html>\n")