dataimport.py
changeset 8834 6947201033be
parent 8833 39f81e2db2fc
child 8835 3612b760488b
--- a/dataimport.py	Tue Apr 02 12:12:41 2013 +0200
+++ b/dataimport.py	Tue Apr 02 12:04:22 2013 +0200
@@ -431,7 +431,14 @@
         # If an error is raised, do not continue.
         formatted_row = []
         for col in columns:
-            value = row[col]
+            if isinstance(row, dict):
+                value = row.get(col)
+            elif isinstance(row, (tuple, list)):
+                value = row[col]
+            else:
+                raise ValueError("Input data of improper type: %s; "
+                                 "expected tuple, list or dict." 
+                                 % type(row).__name__)
             if value is None:
                 value = 'NULL'
             elif isinstance(value, (long, int, float)):