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

[tor-commits] [stem/master] Defaulting connect_* to provide a Controller



commit c03ebb23ae39f9c9b68a1471dbf3debb30c399a7
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jun 3 21:26:21 2012 -0700

    Defaulting connect_* to provide a Controller
    
    As a TODO comment mentioned, the connect_* convenience functions were supposed
    to provide a higher level controller class when one was available. It now does.
---
 stem/connection.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/stem/connection.py b/stem/connection.py
index 99bc623..3f971bf 100644
--- a/stem/connection.py
+++ b/stem/connection.py
@@ -72,13 +72,14 @@ import binascii
 
 import stem.response
 import stem.socket
+import stem.control
 import stem.version
 import stem.util.enum
 import stem.util.system
 import stem.util.log as log
 from stem.response.protocolinfo import AuthMethod
 
-def connect_port(control_addr = "127.0.0.1", control_port = 9051, password = None, chroot_path = None, controller = None):
+def connect_port(control_addr = "127.0.0.1", control_port = 9051, password = None, chroot_path = None, controller = stem.control.Controller):
   """
   Convenience function for quickly getting a control connection. This is very
   handy for debugging or CLI setup, handling setup and prompting for a password
@@ -94,8 +95,6 @@ def connect_port(control_addr = "127.0.0.1", control_port = 9051, password = Non
   :returns: authenticated control connection, the type based on the controller argument
   """
   
-  # TODO: replace the controller arg's default when we have something better
-  
   try:
     control_port = stem.socket.ControlPort(control_addr, control_port)
   except stem.socket.SocketError, exc:
@@ -104,7 +103,7 @@ def connect_port(control_addr = "127.0.0.1", control_port = 9051, password = Non
   
   return _connect(control_port, password, chroot_path, controller)
 
-def connect_socket_file(socket_path = "/var/run/tor/control", password = None, chroot_path = None, controller = None):
+def connect_socket_file(socket_path = "/var/run/tor/control", password = None, chroot_path = None, controller = stem.control.Controller):
   """
   Convenience function for quickly getting a control connection. For more
   information see the connect_port function.



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