[tor-commits] [flashproxy/master] Factor -4, -6, and --unsafe-logging into "common" options.

dcf at torproject.org dcf at torproject.org
Thu Oct 10 19:16:19 UTC 2013


commit 309f9b6e55e1000186c7affd48cf02ef8465931a
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Oct 10 12:08:21 2013 -0700

    Factor -4, -6, and --unsafe-logging into "common" options.
---
 flashproxy-client |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/flashproxy-client b/flashproxy-client
index c4216e3..bd314aa 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -1005,35 +1005,32 @@ def build_register_command(method):
     if not script_dir:
         # Maybe the script was read from stdin; in any case don't guess at the directory.
         raise ValueError("Can't find executable directory for registration helpers")
-    af = []
-    if options.address_family == socket.AF_INET:
-        af = ["-4"]
-    elif options.address_family == socket.AF_INET6:
-        af = ["-6"]
+
     # "common" is options shared by every registration helper.
     common = []
+    if options.address_family == socket.AF_INET:
+        common += ["-4"]
+    elif options.address_family == socket.AF_INET6:
+        common += ["-6"]
     if options.transport is not None:
         common += ["--transport", options.transport]
+    if not options.safe_logging:
+        common += ["--unsafe-logging"]
+
     if method == "appspot":
-        command = [os.path.join(script_dir, "flashproxy-reg-appspot")] + af + common
+        command = [os.path.join(script_dir, "flashproxy-reg-appspot")] + common
         if options.facilitator_pubkey_filename is not None:
             command += ["--facilitator-pubkey", options.facilitator_pubkey_filename]
-        if not options.safe_logging:
-            command += ["--unsafe-logging"]
         return command
     elif method == "email":
-        command = [os.path.join(script_dir, "flashproxy-reg-email")] + af + common
+        command = [os.path.join(script_dir, "flashproxy-reg-email")] + common
         if options.facilitator_pubkey_filename is not None:
             command += ["--facilitator-pubkey", options.facilitator_pubkey_filename]
-        if not options.safe_logging:
-            command += ["--unsafe-logging"]
         return command
     elif method == "http":
-        command = [os.path.join(script_dir, "flashproxy-reg-http")] + af + common
+        command = [os.path.join(script_dir, "flashproxy-reg-http")] + common
         if options.facilitator_url is not None:
             command += ["-f", options.facilitator_url]
-        if not options.safe_logging:
-            command += ["--unsafe-logging"]
         return command
     else:
         raise ValueError("Unknown registration method \"%s\"" % method)





More information about the tor-commits mailing list