Skip to content

Commit

Permalink
Option name can be dashed
Browse files Browse the repository at this point in the history
  • Loading branch information
mher committed Dec 15, 2011
1 parent 597f70b commit 6dae686
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tornado/options.py
Expand Up @@ -126,7 +126,6 @@ def parse_command_line(args=None):
break
arg = args[i].lstrip("-")
name, equals, value = arg.partition("=")
name = name.replace('-', '_')
if not name in options:
print_help()
raise Error('Unrecognized command line option: %r' % name)
Expand Down Expand Up @@ -187,6 +186,8 @@ def instance(cls):
return cls._instance

def __getattr__(self, name):
if '_' in name and name.replace('_', '-') in self:
name = name.replace('_', '-')
if isinstance(self.get(name), _Option):
return self[name].value()
raise AttributeError("Unrecognized option %r" % name)
Expand Down

0 comments on commit 6dae686

Please sign in to comment.