[Pcsclite-cvs-commit] r5601 - /website/matrix.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Wed Feb 16 13:49:47 UTC 2011


Author: rousseau
Date: Wed Feb 16 13:49:34 2011
New Revision: 5601

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5601
Log:
Always add a 'features' entry for each reader with an empty list

Modified:
    website/matrix.py

Modified: website/matrix.py
URL: http://svn.debian.org/wsvn/pcsclite/website/matrix.py?rev=5601&op=diff
==============================================================================
--- website/matrix.py (original)
+++ website/matrix.py Wed Feb 16 13:49:34 2011
@@ -48,6 +48,8 @@
     parse a reader CCID descriptor and return a dictionnary
     """
     reader_dict = {}
+    reader_dict['features'] = list()
+
     reader_file = open(path + reader)
     for line in reader_file.readlines():
         line = line[0:-1]
@@ -55,6 +57,7 @@
         if (len(l) > 1):
             reader_dict[l[0]] = l[1].strip(" ")
     reader_file.close()
+
     return reader_dict
 
 
@@ -85,22 +88,21 @@
     for r in readers.keys():
         readers[r]['section'] = section
         readers[r]['iManufacturer'] = html_escape(readers[r]['iManufacturer'])
+
         for o in config.options(r):
             if o == 'features':
                 # for the features we use a list
-                readers[r][o] = [config.get(r, o)]
+                readers[r][o].append(config.get(r, o))
             else:
                 readers[r][o] = html_escape(config.get(r, o))
 
         bPINSupport = int(readers[r]['bPINSupport'], 16)
-        if bPINSupport != 0 and not 'features' in readers[r]:
-            readers[r]['features'] = list()
         if bPINSupport & 1:
             readers[r]['features'].append("PIN Verification")
         if bPINSupport & 2:
             readers[r]['features'].append("PIN Modification")
         if int(readers[r]['dwFeatures'], 16) & 0x0800:
-            readers[r].setdefault('features', ["ICCD"])
+            readers[r]['features'].append("ICCD")
 
     #pp.pprint(readers["GemPCPinpad.txt"])
     return readers
@@ -345,7 +347,7 @@
                     manufacturer=m,
                     product=readers[r]['iProduct'])
 
-            features = ", ".join(readers[r].get('features', ""))
+            features = ", ".join(readers[r]['features'])
             if features:
                 note_layer.write_layer('features', features=features)
 




More information about the Pcsclite-cvs-commit mailing list