From 759734864e72c209d62c970d2e325e96ae02fcb7 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 24 Oct 2008 20:21:27 -0600 Subject: Finished Env._finalize() and corresponding unit tests --- ipalib/config.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ipalib/config.py') diff --git a/ipalib/config.py b/ipalib/config.py index bced62fda..71d3024cd 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -168,7 +168,7 @@ class Env(object): and the location of the configuration file. """ self.__doing('_bootstrap') - for (key, value) in overrides.items(): + for (key, value) in overrides.iteritems(): self[key] = value if 'in_tree' not in self: if self.bin == self.site_packages and \ @@ -209,11 +209,11 @@ class Env(object): self.log = path.join(self.dot_ipa, 'log', name) else: self.log = path.join('/', 'var', 'log', 'ipa', name) - for (key, value) in defaults.items(): + for (key, value) in defaults.iteritems(): if key not in self: self[key] = value - def _finalize(self): + def _finalize(self, **lastchance): """ Finalize and lock environment. @@ -222,11 +222,14 @@ class Env(object): """ self.__doing('_finalize') self.__do_if_not_done('_finalize_core') + for (key, value) in lastchance.iteritems(): + if key not in self: + self[key] = value self.__lock__() def _merge_config(self, conf_file): """ - Merge in values from ``conf_file`` into this `Env`. + Merge values from ``conf_file`` into this `Env`. """ section = constants.CONFIG_SECTION if not path.isfile(conf_file): @@ -258,6 +261,9 @@ class Env(object): ) object.__setattr__(self, '_Env__locked', True) + def __islocked__(self): + return self.__locked + def __getattr__(self, name): """ Return the attribute named ``name``. -- cgit