[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] 5935 - Add descriptions to filters



commit c0b05e570dd484f5e6008ec24e416b07accae48c
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Wed Jun 13 18:32:25 2012 -0700

    5935 - Add descriptions to filters
    
    Adds the 'description' attribute to filters.
    This attribute is used to indicate which filters are applicable
    to a bridge in the assignments.log
    
    The description should be a string of format k=v, for example:
    filterBridgesByIP4.description is 'ip=4'
---
 lib/bridgedb/Filters.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/bridgedb/Filters.py b/lib/bridgedb/Filters.py
index fd79704..5654cb5 100644
--- a/lib/bridgedb/Filters.py
+++ b/lib/bridgedb/Filters.py
@@ -19,6 +19,7 @@ def filterAssignBridgesToRing(hmac, numRings, assignedRing):
             return False
         f.__name__ = "filterAssignBridgesToRing(%s, %s, %s)" % (hmac, numRings,
                                                                  assignedRing)
+        setattr(f, "description", "ring=%d" % assignedRing)
         funcs[ruleset] = f
         return f
 
@@ -31,6 +32,7 @@ def filterBridgesByRules(rules):
             r = [f(x) for f in rules]
             if False in r: return False
             return True
+        setattr(g, "description", " ".join([getattr(f,'description','') for f in rules]))
         funcs[ruleset] = g
         return g  
 
@@ -44,6 +46,7 @@ def filterBridgesByIP4(bridge):
         if type(k) is IPv4Address:
             return True
     return False
+setattr(filterBridgesByIP4, "description", "ip=4")
 
 def filterBridgesByIP6(bridge):
     try:
@@ -55,6 +58,7 @@ def filterBridgesByIP6(bridge):
         if type(k) is IPv6Address:
             return True
     return False
+setattr(filterBridgesByIP6, "description", "ip=6")
 
 def filterBridgesByOnlyIP4(bridge):
     for k in bridge.or_addresses.keys():



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits