summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-03-26 14:05:42 +0300
committerLars Wirzenius <liw@liw.fi>2017-03-26 14:05:42 +0300
commit7c1ad52dd01c1f58fc7d08c0a4880ab51960718d (patch)
tree1f5713e7c406ecef9be9513619331bbcd71c615d
parentc12d0f69299f02e0a28ac5cd75b9d757469990b4 (diff)
downloadvmdb2-7c1ad52dd01c1f58fc7d08c0a4880ab51960718d.tar.gz
Make State.as_dict return everything not initially there
-rw-r--r--vmdb/state.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/vmdb/state.py b/vmdb/state.py
index d9f3840..d64244d 100644
--- a/vmdb/state.py
+++ b/vmdb/state.py
@@ -18,9 +18,13 @@
class State(object):
+ def __init__(self):
+ self._attrs = {} # make sure this attribute exists
+ self._attrs = self.as_dict()
+
def as_dict(self):
return {
key: getattr(self, key)
for key in dir(self)
- if not key.startswith('_') and not key == 'as_dict'
+ if not key in self._attrs
}