[tor-commits] [arm/master] Dropping private and default policy

atagar at torproject.org atagar at torproject.org
Mon Sep 8 07:15:22 UTC 2014


commit 63a2e28812d5521d13b22da3483c1ad998352efc
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 7 14:22:25 2014 -0700

    Dropping private and default policy
    
    Using Stem's new functions to drop our private policy prefix and condense the
    default suffix to '<default>'. This is things our last arm release did so just
    regaining parity.
---
 arm/header_panel.py |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 164e50d..bc06089 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -326,10 +326,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
     if not vals.exit_policy:
       return
 
-    # TODO: exclude private policy prefix?
-    # TODO: replace the default suffix policy with a cyan '<default>'
-
-    rules = list(vals.exit_policy)
+    rules = list(vals.exit_policy.strip_private().strip_default())
 
     for i, rule in enumerate(rules):
       policy_color = 'green' if rule.is_accept else 'red'
@@ -338,6 +335,12 @@ class HeaderPanel(panel.Panel, threading.Thread):
       if i < len(rules) - 1:
         x = self.addstr(y, x, ', ')
 
+    if vals.exit_policy.has_default():
+      if rules:
+        x = self.addstr(y, x, ', ')
+
+      self.addstr(y, x, '<default>', curses.A_BOLD, 'cyan')
+
   def _draw_newnym_option(self, x, y, width, vals):
     """
     Provide a notice for requiesting a new identity, and time until it's next





More information about the tor-commits mailing list