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

[tor-bugs] #7832 [Stem]: Get some consistency in Controller default args



#7832: Get some consistency in Controller default args
------------------------+---------------------------------------------------
 Reporter:  atagar      |          Owner:  atagar
     Type:  defect      |         Status:  new   
 Priority:  major       |      Milestone:        
Component:  Stem        |        Version:        
 Keywords:  controller  |         Parent:        
   Points:              |   Actualpoints:        
------------------------+---------------------------------------------------
 A major pain point of using TorCtl was that just about every method could
 raise an exception. This is 'proper' from a standpoint of correctness but
 made it a pita to use, causing folks (including me) to make wrapper
 libraries.

 A few of our methods based on arm, like get_info() and get_conf(), have an
 optional 'default' argument that suppresses exceptions. This is great
 since it lets us have nice code like...

 {{{
 print "my version is %s" % controller.get_info('version', 'unknown')
 }}}

 ... instead of...

 {{{
 try:
   my_version = controller.get_info('version')
 except:
   my_version = 'unknown'

 print "my version is %s" % my_version
 }}}

 However, as we've added more methods to the Controller class this has
 largely gone by the wayside. In some cases that makes sense, but we should
 look over our API to figure out what sort of class-wide conventions we
 want it to have with respect to defaults.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7832>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs