Storage.__class__ = dict tricks isinstance
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-20 11:57:27) dev
|
Version 2.00.0 (2012-08-20 12:04:52) dev
|
||||||
|
|||||||
+3
-1
@@ -51,7 +51,7 @@ class List(list):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
class Storage(object):
|
class Storage(object):
|
||||||
|
__class__ = dict
|
||||||
"""
|
"""
|
||||||
A Storage object is like a dictionary except `obj.foo` can be used
|
A Storage object is like a dictionary except `obj.foo` can be used
|
||||||
in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.
|
in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.
|
||||||
@@ -100,6 +100,8 @@ class Storage(object):
|
|||||||
return self.__dict__.values()
|
return self.__dict__.values()
|
||||||
def items(self):
|
def items(self):
|
||||||
return self.__dict__.items()
|
return self.__dict__.items()
|
||||||
|
def len(self):
|
||||||
|
return len(self.__dict__)
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self.__dict__.__iter__()
|
return self.__dict__.__iter__()
|
||||||
def has_key(self,key):
|
def has_key(self,key):
|
||||||
|
|||||||
Reference in New Issue
Block a user