[tor-commits] [oonib/master] simpler methods in Storage

art at torproject.org art at torproject.org
Wed Apr 23 14:31:51 UTC 2014


commit f5001bdebb0395b0817144c1d05a8466ac067714
Author: Darius Bacon <darius at wry.me>
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):
     """





More information about the tor-commits mailing list