Skip to content
Snippets Groups Projects
Commit bccb429f authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Config: fix native variable scan to ignore invalid identifiers (e.g. $1)

parent c5208e80
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ Config ...@@ -13,6 +13,7 @@ Config
------ ------
* Fixed error due to variables at namelist level * Fixed error due to variables at namelist level
* Fixed recognition of native variables to ignore invalid variable names
Tools Tools
----- -----
......
...@@ -226,8 +226,11 @@ def format_namelist(section, group=None, default_value=''): ...@@ -226,8 +226,11 @@ def format_namelist(section, group=None, default_value=''):
def format_vars(section, key, log, fmt): def format_vars(section, key, log, fmt):
def replace(match): def replace(match):
log.add(match.group(1)) result = match.group(1)
return fmt%match.group(1) if result.isidentifier():
log.add(result)
return fmt%result
return result
def transform(string): def transform(string):
return re.sub(r'\$\{(\w+)\}', replace, string) return re.sub(r'\$\{(\w+)\}', replace, string)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment