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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Mar 1 17:35:15 UTC 2013


Author: rousseau
Date: Fri Mar  1 17:35:15 2013
New Revision: 6547

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6547
Log:
Sort the matrix according to the first feature

For Readers sorted by 'features' field matrix only the first feature is
used. The idea is to sort all the 'contactless' readers in the same
group even is some reader have other features.

Modified:
    website/matrix.py

Modified: website/matrix.py
URL: http://svn.debian.org/wsvn/pcsclite/website/matrix.py?rev=6547&op=diff
==============================================================================
--- website/matrix.py (original)
+++ website/matrix.py Fri Mar  1 17:35:15 2013
@@ -589,12 +589,21 @@
         # create a list of tuples [field1 value, field2 value, reader]
         index = list()
         if field == 'section':
+            # for section we convert the text into a number using alpha_sections
             for reader in readers.keys():
                 index.append([alpha_sections[readers[reader]['section']],
                     readers[reader]['iManufacturer'], reader])
         else:
             for reader in readers.keys():
-                index.append([readers[reader].get(field, ""),
+                # for lists we only use the first element
+                field1 = readers[reader].get(field, "")
+                if type(field1) == list:
+                    try:
+                        field1 = field1[0]
+                    except IndexError:
+                        # the list is empty
+                        field1 = ""
+                index.append([field1,
                     alpha_sections[readers[reader]['section']], reader])
 
         if field in ['dwDefaultClock', 'dwMaximumClock', 'dwDataRate',




More information about the Pcsclite-cvs-commit mailing list