Change in ...pysim[master]: pySim-prog: use case insensitive CSV headers.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Sep 12 11:19:52 UTC 2019


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/15498


Change subject: pySim-prog: use case insensitive CSV headers.
......................................................................

pySim-prog: use case insensitive CSV headers.

Inside of pySim all CSV headers are defined in lower case and are
evaluated case sensitive. This means that a CSV file that contains the
headers in uppercase for example will not parse. Lets make sure that the
CSV headers are evaluated case insensitive to increase compatibility
with slightly different formats.

Change-Id: I1a476e7fc521d1aad2956feec3db196156961d20
---
M pySim-prog.py
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/98/15498/1

diff --git a/pySim-prog.py b/pySim-prog.py
index 974dbd1..a24cd1a 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -457,6 +457,10 @@
 	import csv
 	f = open(opts.read_csv, 'r')
 	cr = csv.DictReader(f)
+
+        # Lower-case fieldnames
+        cr.fieldnames = [ field.lower() for field in cr.fieldnames ]
+
 	i = 0
         if not 'iccid' in cr.fieldnames:
             raise Exception("CSV file in wrong format!")

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/15498
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1a476e7fc521d1aad2956feec3db196156961d20
Gerrit-Change-Number: 15498
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190912/69779a43/attachment.htm>


More information about the gerrit-log mailing list