From 7c4789c427eb9ef6f40a2b43ff305d2b331c92d8 Mon Sep 17 00:00:00 2001 From: Devan Franchini Date: Thu, 9 Oct 2014 13:54:43 -0400 Subject: 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. --- WebappConfig/config.py | 9 ++++++--- 1 file 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']): -- cgit v1.2.3-18-g5258