diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-06-17 16:02:38 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-06-17 16:02:38 +0000 |
commit | 9b1b3f57966edb1fec0d2f7469fa55f0b020ddd5 (patch) | |
tree | d4e505953edb5120abec579bfd777f28164ae23f /paste | |
parent | a0d15632b60ebce78772f487d05ddf73b718ccf7 (diff) | |
download | paste-git-9b1b3f57966edb1fec0d2f7469fa55f0b020ddd5.tar.gz |
Copy namespace over from config, don't delete; that way functions will work
Diffstat (limited to 'paste')
-rw-r--r-- | paste/pyconfig.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/paste/pyconfig.py b/paste/pyconfig.py index 6bde38d..4356812 100644 --- a/paste/pyconfig.py +++ b/paste/pyconfig.py @@ -107,24 +107,24 @@ class Config(UserDict.DictMixin, object): namespace[key] = builder(self, filename, namespace) content = content.replace("\r\n","\n") exec content in namespace - if load_self: - for name in namespace.keys(): - if (hasattr(__builtins__, name) - or name.startswith('_')): - del namespace[name] - continue - if orig.has_key(name) and namespace[name] is orig[name]: - del namespace[name] - continue - if isinstance(namespace[name], types.ModuleType): - del namespace[name] - continue + added_ns = {} + for name in namespace.keys(): + if (hasattr(__builtins__, name) + or name.startswith('_')): + continue + if (load_self + and orig.has_key(name) + and namespace[name] is orig[name]): + continue + if isinstance(namespace[name], types.ModuleType): + continue + added_ns[name] = namespace[name] for key, value in old_values.items(): - if value is None and namespace.has_key(key): - del namespace[key] + if value is None and key in added_ns: + del added_ns[key] elif value is not None: - namespace[key] = value - return namespace + added_ns[key] = value + return added_ns def make_loader(self, relative_to, namespace): def load(filename): |