Patch by Paul Sokolovsky to support the get() method.
This commit is contained in:
parent
50765abb29
commit
2f7df12f33
@ -59,6 +59,11 @@ class Shelf:
|
|||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
return self.dict.has_key(key)
|
return self.dict.has_key(key)
|
||||||
|
|
||||||
|
def get(self, key, default=None):
|
||||||
|
if self.dict.has_key(key):
|
||||||
|
return self[key]
|
||||||
|
return default
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
f = StringIO(self.dict[key])
|
f = StringIO(self.dict[key])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user