From 8615d58e803a74827417d8bd7fa673ea48cf8cb6 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 4 May 2016 10:34:02 -0700 Subject: [PATCH] Fix DataHolder to handle hasattr It needs to raise an AttributeError if it doesn't have the attribute. --- src/pylorax/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pylorax/base.py b/src/pylorax/base.py index ae6813c3..dad1a638 100644 --- a/src/pylorax/base.py +++ b/src/pylorax/base.py @@ -55,7 +55,10 @@ class DataHolder(dict): self[attr] = value def __getattr__(self, attr): - return self[attr] + if attr in self: + return self[attr] + else: + raise AttributeError def __setattr__(self, attr, value): self[attr] = value