From 5cb1c6ad584db33c17237c77e2d84d6f1dc24313 Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 23 Dec 2014 11:16:58 +0100 Subject: [PATCH] Restore readDatagroups function accidently deleted in 1e7492a8068610c26dd7390ea3592a35724bbc6f --- .../src/vpicc/virtualsmartcard/CardGenerator.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py index b810af5..2487b96 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py @@ -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()