Skip to content
Snippets Groups Projects
Commit 670d3d29 authored by Stefan Froehlich's avatar Stefan Froehlich
Browse files

Task #9058 Its possible to have this functionality when remembering the order...

Task #9058 Its possible to have this functionality when remembering the order of the replacement keys. Not a very elegant solution but it should work.
parent 45a823e3
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ import os ...@@ -3,6 +3,7 @@ import os
import sys import sys
import copy import copy
import re import re
from collections import OrderedDict
from lofarpipe.support.parset import Parset from lofarpipe.support.parset import Parset
from lofarpipe.support.control import control from lofarpipe.support.control import control
...@@ -504,7 +505,7 @@ class GenericPipeline(control): ...@@ -504,7 +505,7 @@ class GenericPipeline(control):
steplist = [] steplist = []
def _replace_values(self): def _replace_values(self):
replacedict = {} replacedict = OrderedDict()
for check in self.parset.keywords(): for check in self.parset.keywords():
if str(check).startswith('!'): if str(check).startswith('!'):
replacedict[str(check).lstrip('!').lstrip(' ')] = str(self.parset[check]) replacedict[str(check).lstrip('!').lstrip(' ')] = str(self.parset[check])
...@@ -512,7 +513,7 @@ class GenericPipeline(control): ...@@ -512,7 +513,7 @@ class GenericPipeline(control):
replacedict[str(check).replace('pipeline.replace.', '').lstrip(' ')] = str(self.parset[check]) replacedict[str(check).replace('pipeline.replace.', '').lstrip(' ')] = str(self.parset[check])
#print 'REPLACEDICT: ',replacedict #print 'REPLACEDICT: ',replacedict
for check in self.parset.keywords(): for check in self.parset.keywords():
for k, v in replacedict.iteritems(): for k, v in reversed(replacedict.items()):
if '{{ '+k+' }}' in str(self.parset[check]): if '{{ '+k+' }}' in str(self.parset[check]):
replacestring = str(self.parset[check]).replace('{{ '+k+' }}',v) replacestring = str(self.parset[check]).replace('{{ '+k+' }}',v)
self.parset.replace(check,replacestring) self.parset.replace(check,replacestring)
......
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