Restore readDatagroups function accidently deleted in 1e7492a806

This commit is contained in:
Dominik
2014-12-23 11:16:58 +01:00
parent 991ba148d9
commit 5cb1c6ad58

View File

@@ -424,6 +424,18 @@ class CardGenerator(object):
finally:
db.close()
def readDatagroups(self, datasetfile):
"""Read Datagroups from file"""
with open(datasetfile, 'r') as f:
for line in f:
if (not line.startswith("#")) and (not len(line.strip()) == 0):
# spaces after equal sign are allowed to get strings with leading spaces!
line=line.replace(" =", "=")
splitLine = line.split("=")
# we don't want to have the newline char from dataset file as part of the value!!
self.datagroups[splitLine[0]] = splitLine[1].rstrip("\n\r")
f.close()
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser()