# HG changeset patch # User Vladimir Popescu # Date 1364897062 -7200 # Node ID 6947201033be9f054170fab448fbbee8fa0f0346 # Parent 39f81e2db2fca0131f58c8de171352fb60b1f52e [dataimport] Handle various data formats when creating buffers from data. :note: On the long run, this should be addressed before, when these data are created. diff -r 39f81e2db2fc -r 6947201033be dataimport.py --- 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)):