Opened 8 years ago

Closed 8 years ago

#7832 closed defect (fixed)

Get some consistency in Controller default args

Reported by: atagar Owned by: atagar
Priority: High Milestone:
Component: Archived/Stem Version:
Severity: Keywords: controller
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


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...

  my_version = controller.get_info('version')
  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.

Child Tickets

Change History (1)

comment:1 Changed 8 years ago by atagar

Resolution: fixed
Status: newclosed

Imho this is a pretty high priority thing so I took care of this while merging #7152...

Note: See TracTickets for help on using tickets.