aboutsummaryrefslogtreecommitdiff
path: root/potpourri
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-04-29 05:22:45 +0000
committerRob Austein <sra@hactrn.net>2016-04-29 05:22:45 +0000
commit136fa6ad3d9036b9ebae4a52f5cfcf467be3a143 (patch)
treef9771fe3aea9077ee00dd50da84ceb5adae9e55d /potpourri
parent2787535ccfb6efde1a329a6793e672f6fdc42a3f (diff)
Throw correct exceptions in container LazyDict container methods, not
that anybody is likely to care. svn path=/branches/tk705/; revision=6405
Diffstat (limited to 'potpourri')
-rwxr-xr-xpotpourri/ca-unpickle.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/potpourri/ca-unpickle.py b/potpourri/ca-unpickle.py
index d49d0186..c988a168 100755
--- a/potpourri/ca-unpickle.py
+++ b/potpourri/ca-unpickle.py
@@ -28,15 +28,18 @@ class LazyDict(object):
def __init__(self, *args, **kwargs):
self._d = dict(*args, **kwargs)
- def __getitem__(self, name):
+ def __getattr__(self, name):
if name in self._d:
return self._d[name]
raise AttributeError
- __getattr__ = __getitem__
+ def __getitem__(self, name):
+ if name in self._d:
+ return self._d[name]
+ raise KeyError
def __missing__(self, name):
- raise AttributeError
+ raise KeyError
def __iter__(self):
return self._d.iterkeys()