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

Templates: changed 'format_namelist' function to allow use of (yet) undefined groups

parent b1c90a6b
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,14 @@ Make Experiments!
Release Changes
---------------
Release 1.0.8
=============
Templates
---------
* Changed 'format_namelist' function to allow use of (yet) undefined groups
Release 1.0.7
=============
......
......@@ -153,6 +153,10 @@ def cut_remove_list(section, key):
def format_namelist(section, group=None):
'''Format config section as a namelist.
If given, just format a single namelist group'''
# Skip undefined groups
if group and group not in section:
feedback.debug("namelist '"+group+"' not defined (yet)")
return ''
# Settings
base_indent = 4
# Create list of removed namelist groups.
......
......@@ -502,6 +502,7 @@ class NamelistTestCase(MkexpSimpleTestCase):
self.run_test("""
%{format_namelist(namelists.namelist)}
%{format_namelist(namelists.namelist, 'group2')}
%{format_namelist(namelists.namelist, 'no such group')}
""", """
&group1
value = 41
......
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