summaryrefslogtreecommitdiffstats
path: root/ipalib/config.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-12-22 15:51:54 -0700
committerJason Gerard DeRose <jderose@redhat.com>2008-12-22 15:51:54 -0700
commitc070d390e92df0c9cc6b6070e6c94bd3a130ff65 (patch)
tree1bee2697b5d4a6a22594128e7774232a374fbdf2 /ipalib/config.py
parent5b637f6a18a647a0ff084b2932faa1a4a887a5c2 (diff)
downloadfreeipa-c070d390e92df0c9cc6b6070e6c94bd3a130ff65.tar.gz
freeipa-c070d390e92df0c9cc6b6070e6c94bd3a130ff65.tar.xz
freeipa-c070d390e92df0c9cc6b6070e6c94bd3a130ff65.zip
Removed Env.__getattr__(); Env no longer accepts callables for values (no more dynamic/lazy values)
Diffstat (limited to 'ipalib/config.py')
-rw-r--r--ipalib/config.py38
1 files changed, 11 insertions, 27 deletions
diff --git a/ipalib/config.py b/ipalib/config.py
index 06ecb13f2..8a23cde65 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -176,16 +176,6 @@ class Env(object):
def __islocked__(self):
return self.__locked
- def __getattr__(self, name):
- """
- Return the attribute named ``name``.
- """
- if name in self.__d:
- return self[name]
- raise AttributeError('%s.%s' %
- (self.__class__.__name__, name)
- )
-
def __setattr__(self, name, value):
"""
Set the attribute named ``name`` to ``value``.
@@ -204,12 +194,7 @@ class Env(object):
"""
Return the value corresponding to ``key``.
"""
- if key not in self.__d:
- raise KeyError(key)
- value = self.__d[key]
- if callable(value):
- return value()
- return value
+ return self.__d[key]
def __setitem__(self, key, value):
"""
@@ -224,17 +209,16 @@ class Env(object):
raise AttributeError('cannot overwrite %s.%s with %r' %
(self.__class__.__name__, key, value)
)
- if not callable(value):
- if isinstance(value, basestring):
- value = str(value.strip())
- if value.lower() == 'true':
- value = True
- elif value.lower() == 'false':
- value = False
- elif value.isdigit():
- value = int(value)
- assert type(value) in (str, int, bool)
- object.__setattr__(self, key, value)
+ if isinstance(value, basestring):
+ value = str(value.strip())
+ if value.lower() == 'true':
+ value = True
+ elif value.lower() == 'false':
+ value = False
+ elif value.isdigit():
+ value = int(value)
+ assert type(value) in (str, int, bool)
+ object.__setattr__(self, key, value)
self.__d[key] = value
def __contains__(self, key):