[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [oonib/master] simpler methods in Storage
commit f5001bdebb0395b0817144c1d05a8466ac067714
Author: Darius Bacon <darius@xxxxxx>
Date: Tue Apr 15 16:14:51 2014 -0700
simpler methods in Storage
---
oonib/__init__.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/oonib/__init__.py b/oonib/__init__.py
index be102df..ee1946b 100644
--- a/oonib/__init__.py
+++ b/oonib/__init__.py
@@ -28,10 +28,7 @@ class Storage(dict):
None
"""
def __getattr__(self, key):
- try:
- return self[key]
- except KeyError, k:
- return None
+ return self.get(key)
def __setattr__(self, key, value):
self[key] = value
@@ -49,8 +46,7 @@ class Storage(dict):
return dict(self)
def __setstate__(self, value):
- for (k, v) in value.items():
- self[k] = v
+ self.update(value.items())
def randomStr(length, num=True):
"""
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits