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

[tor-commits] [nyx/master] Replace use of get_custom_conf()



commit e15079a29ec126dca91159308ea23ea2136c1463
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Dec 24 09:22:33 2015 -0800

    Replace use of get_custom_conf()
    
    As mentioned on the corresponding Stem commit, we don't really need this
    helper. We did with torrc validation, but since we'll be dropping this feature
    we can just use the raw 'GETINFO config-text' response.
---
 nyx/config_panel.py    |    3 ++-
 nyx/util/tor_config.py |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/nyx/config_panel.py b/nyx/config_panel.py
index 05332dc..c2fe11a 100644
--- a/nyx/config_panel.py
+++ b/nyx/config_panel.py
@@ -311,7 +311,8 @@ class ConfigPanel(panel.Panel):
     Confirmation dialog for saving tor's configuration.
     """
 
-    config_lines = tor_controller().get_custom_conf([], include_values = True)
+    config_text = tor_controller().get_info('config-text', None)
+    config_lines = config_text.splitlines() if config_text else []
 
     with nyx.popups.popup_window(len(config_lines) + 2) as (popup, width, height):
       if not popup or height <= 2:
diff --git a/nyx/util/tor_config.py b/nyx/util/tor_config.py
index 9d2d3f5..f404d3d 100644
--- a/nyx/util/tor_config.py
+++ b/nyx/util/tor_config.py
@@ -146,7 +146,8 @@ def save_conf(destination = None, contents = None):
 
   is_saveconf, start_time = True, time.time()
 
-  current_config = tor_controller().get_custom_conf([], include_values = True)
+  config_text = tor_controller().get_info('config-text', None)
+  current_config = config_text.splitlines() if config_text else []
 
   if not contents:
     contents = current_config
@@ -239,7 +240,11 @@ def validate(contents = None):
   """
 
   controller = tor_controller()
-  custom_options = controller.get_custom_conf([])
+
+  config_text = tor_controller().get_info('config-text', None)
+  config_lines = config_text.splitlines() if config_text else []
+  custom_options = list(set([line.split(' ')[0] for line in config_lines]))
+
   issues_found, seen_options = [], []
 
   # Strips comments and collapses multiline multi-line entries, for more



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