Commit 50417eb2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* environment variable keys are case sensitive.

* allow specifying an empty string for the environment variable value.
* if PATH is specified, it should have higher priority than the existing value (but merging with the existing value might be a bad idea and might be removed later).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42235 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 253819f9
...@@ -66,13 +66,14 @@ def application(global_config, **local_config): ...@@ -66,13 +66,14 @@ def application(global_config, **local_config):
prefix = 'env-' prefix = 'env-'
environment_dict = {} environment_dict = {}
for parameter_name, value in local_config.iteritems(): for parameter_name, value in local_config.iteritems():
if value and parameter_name[:len(prefix)] == prefix: if parameter_name.startswith(prefix):
variable_name = parameter_name[len(prefix):].upper() value = value or ''
variable_name = parameter_name[len(prefix):]
if variable_name == 'PATH': if variable_name == 'PATH':
# merge only for PATH # merge only for PATH
current_value = os.environ.get(variable_name, '') current_value = os.environ.get(variable_name, '')
if current_value: if current_value:
value = current_value + ':' + value value = '%s:%s' % (value, current_value)
environment_dict[variable_name] = value environment_dict[variable_name] = value
gc.enable() gc.enable()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment