]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make options.__getattr__ raise AttributeError instead of Error for consistency
authorBen Darnell <bdarnell@beaker.local>
Mon, 5 Apr 2010 19:23:24 +0000 (12:23 -0700)
committerBen Darnell <bdarnell@beaker.local>
Mon, 5 Apr 2010 19:23:24 +0000 (12:23 -0700)
with standard attribute lookups (so getattr(options, 'foo', None) works
if no option 'foo' has been defined).

tornado/options.py

index 781c2820d498aaa7cfa974afd11b54db69042de4..66bce091e725603421939f035fe7aff5d88c1cb0 100644 (file)
@@ -175,7 +175,7 @@ class _Options(dict):
     def __getattr__(self, name):
         if isinstance(self.get(name), _Option):
             return self[name].value()
-        raise Error("Unrecognized option %r" % name)
+        raise AttributeError("Unrecognized option %r" % name)
 
 
 class _Option(object):