diff options
author | Devan Franchini <twitch153@gentoo.org> | 2014-10-09 13:54:43 -0400 |
---|---|---|
committer | Devan Franchini <twitch153@gentoo.org> | 2015-06-19 15:44:53 -0400 |
commit | 7c4789c427eb9ef6f40a2b43ff305d2b331c92d8 (patch) | |
tree | 7296bf30b78ee1983bd90c11e973a7cd1c0ac006 /WebappConfig | |
parent | {config, debug}.py: Migrates from optparse to argparse (diff) | |
download | webapp-config-7c4789c427eb9ef6f40a2b43ff305d2b331c92d8.tar.gz webapp-config-7c4789c427eb9ef6f40a2b43ff305d2b331c92d8.tar.bz2 webapp-config-7c4789c427eb9ef6f40a2b43ff305d2b331c92d8.zip |
config.py: Adds exception handling for setting env vars
In some cases when setting environment variables you can encounter
an issue where you are trying to set a config value based on the
the environment variable and you run into a runtime error. One
notable situation is when you try to run webapp-config --envall
while running py2.7, you will run into an interpolation issue if
one of your environment variables includes a sort of interpolation
syntax such as: %s.
Diffstat (limited to 'WebappConfig')
-rw-r--r-- | WebappConfig/config.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/WebappConfig/config.py b/WebappConfig/config.py index b708ee0..1b9ebde 100644 --- a/WebappConfig/config.py +++ b/WebappConfig/config.py @@ -873,9 +873,12 @@ class Config: OUT.debug('Adding environment variable', 8) - self.config.set('USER', - key.lower(), - value) + try: + self.config.set('USER', + key.lower(), + value) + except ValueError: + pass if ('define' in options and options['define']): |