[tor-commits] [depictor/master] print a 'missing' line if a BWAuth is missing.

tom at torproject.org tom at torproject.org
Mon Mar 23 16:32:51 UTC 2015


commit c206e542d28ec5748915a17efc3f13be3c377a47
Author: Tom Ritter <tom at ritter.vg>
Date:   Wed Mar 4 20:01:19 2015 +0100

    print a 'missing' line if a BWAuth is missing.
---
 website.py       |   15 +++++++++++----
 write_website.py |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/website.py b/website.py
index 8c4fd0d..2f8c45c 100755
--- a/website.py
+++ b/website.py
@@ -52,8 +52,9 @@ class WebsiteWriter:
 		self.consensus_expirey = timedelta
 	def set_directory_key_warning_time(self, timedelta):
 		self.directory_key_warning_time = timedelta
-	def set_known_params(self, kp):
-		self.known_params = kp
+	def set_config(self, config):
+		self.known_params = config['known_params']
+		self.bandwidth_authorities = config['bandwidth_authorities']
 	def get_consensus_time(self):
 		return self.consensus.valid_after
 
@@ -533,7 +534,6 @@ class WebsiteWriter:
 		if not self.votes:
 			self.site.write("  <tr><td>(No votes.)</td><td></td></tr>\n")
 		else:
-			#XXX - loop over all bwauths, and print if vote is not present
 			for dirauth_nickname in self.votes:
 				vote = self.votes[dirauth_nickname]
 				
@@ -548,6 +548,13 @@ class WebsiteWriter:
 					+ "    <td>" + str(bandwidthWeights)
 					+ " Measured values in w lines</td>\n"
 					+ "  </tr>\n")
+			for dirauth_nickname in self.bandwidth_authorities:
+				if dirauth_nickname not in self.votes:
+					self.site.write("  <tr>\n"
+					+ "    <td>" + dirauth_nickname + "</td>\n"
+					+ "    <td class=\"oiv\">Missing vote</td>\n"
+					+ "  </tr>\n")
+
 		self.site.write("</table>\n")
 
 	#-----------------------------------------------------------------------------------------
@@ -971,7 +978,7 @@ if __name__ == '__main__':
                                     })
 	config = stem.util.conf.get_config("consensus")
 	config.load(os.path.join(os.path.dirname(__file__), 'data', 'consensus.cfg'))
-	w.set_known_params(CONFIG['known_params'])
+	w.set_config(CONFIG)
 
 	w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
 		'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
diff --git a/write_website.py b/write_website.py
index 3e6a500..99e18c5 100755
--- a/write_website.py
+++ b/write_website.py
@@ -63,7 +63,7 @@ def main():
   w = WebsiteWriter()
   w.set_consensuses(consensuses)
   w.set_votes(votes)
-  w.set_known_params(CONFIG['known_params'])
+  w.set_config(CONFIG)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
     'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 'consensus-health.html'), True)





More information about the tor-commits mailing list