mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
samba-tool: give cache_loader pseudo-dict a .get() method
This makes it more dict-like, and makes the next patch (adding samba-tool help) simpler. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
cef83c0cc6
commit
769197dfa3
@ -36,6 +36,12 @@ class cache_loader(dict):
|
||||
'cmd_%s' % attr)()
|
||||
return dict.__getitem__(self, attr)
|
||||
|
||||
def get(self, attr, default=None):
|
||||
try:
|
||||
return self[attr]
|
||||
except KeyError:
|
||||
return default
|
||||
|
||||
def iteritems(self):
|
||||
for key in self:
|
||||
yield (key, self[key])
|
||||
|
Loading…
Reference in New Issue
Block a user