[tor-commits] [bridgedb/develop] Add a human-readable __str__() method to BridgeRequest classes.

isis at torproject.org isis at torproject.org
Wed Dec 20 23:10:05 UTC 2017


commit f37c22c6284f13fb9f26f78926f0d115b468fb71
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Dec 20 21:38:12 2017 +0000

    Add a human-readable __str__() method to BridgeRequest classes.
---
 bridgedb/bridgerequest.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bridgedb/bridgerequest.py b/bridgedb/bridgerequest.py
index e555e0a..d5af05f 100644
--- a/bridgedb/bridgerequest.py
+++ b/bridgedb/bridgerequest.py
@@ -117,6 +117,15 @@ class BridgeRequestBase(object):
         self.client = 'default'
         self.valid = False
 
+    def __str__(self):
+        """Return a human-readable string describing this bridge request."""
+        return "%s(ipVersion=%d, transports=%s, notBlockedIn=%s, valid=%s)" % \
+               (self.__class__.__name__,
+                self.ipVersion,
+                self.transports,
+                self.notBlockedIn,
+                self.valid)
+
     @property
     def ipVersion(self):
         """The IP version of bridge addresses to distribute to the client.





More information about the tor-commits mailing list