summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-14 23:49:36 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-14 23:49:36 +0000
commit88a5b3ae2587ef71efecc1b59eb9ec94e09cacad (patch)
tree86b4830c463c110f5c130501a78f6567457c11fe /ipalib
parent07cd5372779fe88b1dd6c252e157b48a944c4669 (diff)
downloadfreeipa-88a5b3ae2587ef71efecc1b59eb9ec94e09cacad.tar.gz
freeipa-88a5b3ae2587ef71efecc1b59eb9ec94e09cacad.tar.xz
freeipa-88a5b3ae2587ef71efecc1b59eb9ec94e09cacad.zip
169: Renamed DictProxy to MagicDict
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugable.py8
-rw-r--r--ipalib/tests/test_plugable.py12
2 files changed, 10 insertions, 10 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 8d6a80478..45c733543 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -492,11 +492,11 @@ class NameSpace(ReadOnly):
return '%s(<%d members>)' % (self.__class__.__name__, len(self))
-class DictProxy(ReadOnly):
+class MagicDict(ReadOnly):
"""
A read-only dict whose items can also be accessed as attributes.
- Although a DictProxy is read-only, the underlying dict can change (and is
+ Although a MagicDict is read-only, the underlying dict can change (and is
assumed to).
One of these is created for each allowed base in a `Registrar` instance.
@@ -576,7 +576,7 @@ class Registrar(ReadOnly):
self.base = base
self.name = base.__name__
self.sub_d = dict()
- self.dictproxy = DictProxy(self.sub_d)
+ self.dictproxy = MagicDict(self.sub_d)
lock(self)
self.__allowed = allowed
@@ -645,7 +645,7 @@ class Registrar(ReadOnly):
def __getitem__(self, key):
"""
- Returns the DictProxy for plugins subclassed from the base named ``key``.
+ Returns the MagicDict for plugins subclassed from the base named ``key``.
"""
if key not in self.__d:
raise KeyError('no base class named %r' % key)
diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py
index 839451b57..ba665447a 100644
--- a/ipalib/tests/test_plugable.py
+++ b/ipalib/tests/test_plugable.py
@@ -482,18 +482,18 @@ class test_NameSpace(ClassChecker):
no_set(ns, name)
-class test_DictProxy(ClassChecker):
+class test_MagicDict(ClassChecker):
"""
- Tests the `plugable.DictProxy` class.
+ Tests the `plugable.MagicDict` class.
"""
- _cls = plugable.DictProxy
+ _cls = plugable.MagicDict
def test_class(self):
assert self.cls.__bases__ == (plugable.ReadOnly,)
for non_dict in ('hello', 69, object):
raises(AssertionError, self.cls, non_dict)
- def test_DictProxy(self):
+ def test_MagicDict(self):
cnt = 10
keys = []
d = dict()
@@ -559,7 +559,7 @@ def test_Registrar():
for base in [Base1, Base2]:
assert base.__name__ in r
dp = r[base.__name__]
- assert type(dp) is plugable.DictProxy
+ assert type(dp) is plugable.MagicDict
assert len(dp) == 0
# Check that TypeError is raised trying to register something that isn't
@@ -573,7 +573,7 @@ def test_Registrar():
# Check that registration works
r(plugin1)
dp = r['Base1']
- assert type(dp) is plugable.DictProxy
+ assert type(dp) is plugable.MagicDict
assert len(dp) == 1
assert r.Base1 is dp
assert dp['plugin1'] is plugin1