summaryrefslogtreecommitdiffstats
path: root/src/nbblib/plugins.py
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2008-06-25 14:05:22 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2008-07-15 12:28:53 +0200
commit7c8e2cdacaee25c97266911be609dd3c3299eb95 (patch)
tree0124673e9701a1aaaed6291d8ba70eff0c132395 /src/nbblib/plugins.py
parent50329926dae11a934a526315d09eb1e7f897a06e (diff)
downloadnbb-7c8e2cdacaee25c97266911be609dd3c3299eb95.tar.gz
nbb-7c8e2cdacaee25c97266911be609dd3c3299eb95.tar.xz
nbb-7c8e2cdacaee25c97266911be609dd3c3299eb95.zip
Iterate over dict.iteritems() instead of .items()
Diffstat (limited to 'src/nbblib/plugins.py')
-rw-r--r--src/nbblib/plugins.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nbblib/plugins.py b/src/nbblib/plugins.py
index 1b7a653..132a03e 100644
--- a/src/nbblib/plugins.py
+++ b/src/nbblib/plugins.py
@@ -13,14 +13,18 @@ class PluginDict(object):
"""
def __init__(self):
self.dict = {}
- def __getitem__(self, *args):
- return self.dict.__getitem__(*args)
+
+ # This is the important difference between PluginDict and dict.
def __setitem__(self, key, value):
if self.dict.has_key(key):
raise DuplicatePluginName()
else:
self.dict[key] = value
+
+ # Forward all other dict methods.
+ def __getitem__(self, *args): return self.dict.__getitem__(*args)
def items(self): return self.dict.items()
+ def iteritems(self): return self.dict.iteritems()
def keys(self): return self.dict.keys()
def values(self): return self.dict.values()
def __iter__(self): return self.dict.__iter__()