[tor-commits] [compass/master] Fixed bugs around link printing
karsten at torproject.org
karsten at torproject.org
Mon Jan 7 07:09:40 UTC 2013
commit af78f0fcbefab8e63014b23589efe0c489925e2b
Author: Chris Wacek <cwacek at cs.georgetown.edu>
Date: Fri Dec 21 13:51:09 2012 -0500
Fixed bugs around link printing
---
compass.py | 2 +-
util.py | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/compass.py b/compass.py
index a25f72f..1eadaf3 100755
--- a/compass.py
+++ b/compass.py
@@ -269,7 +269,7 @@ class RelayStats(object):
for relay in selection['results']:
print("".join(field.ljust(column_widths[i])
for i,field in
- enumerate(relay.printable_fields())))
+ enumerate(relay.printable_fields(options.links))))
#Print the 'excluded' set if we have it
if selection['excluded']:
diff --git a/util.py b/util.py
index aa30c27..893abcc 100644
--- a/util.py
+++ b/util.py
@@ -58,14 +58,16 @@ class Result():
def jsonify(self):
return self.__dict__
- def printable_fields(self):
+ def printable_fields(self,links=False):
"""
Return this Result object as a list with the fields in the order
expected for printing.
"""
format_str = "%.4f%%|%.4f%%|%.4f%%|%.4f%%|%.4f%%|%s|%s|%s|%s|%s|%s"
formatted = format_str % ( self.cw, self.adv_bw, self.p_guard, self.p_middle, self.p_exit,
- self.nick, self.fp, self.exit, self.guard, self.cc, self.as_info )
+ self.nick,
+ "https://atlas.torproject.org/#details/" + self.fp if links else self.fp,
+ self.exit, self.guard, self.cc, self.as_info )
return formatted.split("|")
class ResultEncoder(json.JSONEncoder):
More information about the tor-commits
mailing list