Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #7832

Closed
Open
Created Dec 30, 2012 by Damian Johnson@atagar

Get some consistency in Controller default args

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking