diff options
author | Tomas Touceda <chiiph@leap.se> | 2013-04-24 16:47:07 -0300 |
---|---|---|
committer | Tomas Touceda <chiiph@leap.se> | 2013-05-07 14:01:10 -0300 |
commit | b1c2e24fb08f69a10a4d91a84ec0e31d91991190 (patch) | |
tree | ef5f2127f85b737fe035b190f6b0a7db83d7c142 /src/leap/mx/util/storage.py | |
parent | b322a390af83addcf9768ae59d31c31a3229b49d (diff) |
Improve the rest and start everything from start_mx
Diffstat (limited to 'src/leap/mx/util/storage.py')
-rw-r--r-- | src/leap/mx/util/storage.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/leap/mx/util/storage.py b/src/leap/mx/util/storage.py deleted file mode 100644 index c4c797a..0000000 --- a/src/leap/mx/util/storage.py +++ /dev/null @@ -1,42 +0,0 @@ - -class Storage(dict): - """ - A Storage object is like a dictionary except `obj.foo` can be used - in addition to `obj['foo']`. - - >>> o = Storage(a=1) - >>> o.a - 1 - >>> o['a'] - 1 - >>> o.a = 2 - >>> o['a'] - 2 - >>> del o.a - >>> o.a - None - """ - def __getattr__(self, key): - try: - return self[key] - except KeyError, k: - return None - - def __setattr__(self, key, value): - self[key] = value - - def __delattr__(self, key): - try: - del self[key] - except KeyError, k: - raise AttributeError, k - - def __repr__(self): - return '<Storage ' + dict.__repr__(self) + '>' - - def __getstate__(self): - return dict(self) - - def __setstate__(self, value): - for (k, v) in value.items(): - self[k] = v |