From 42dc68b1386549f9cc96efb0aed96aec97e67aad Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 22 Apr 2013 11:30:54 +0530 Subject: [PATCH] [data import tool] [fix] empty columns logic --- core/page/data_import_tool/data_import_tool.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py index 76171dfeda..50b2b66b93 100644 --- a/core/page/data_import_tool/data_import_tool.py +++ b/core/page/data_import_tool/data_import_tool.py @@ -169,12 +169,14 @@ def upload(): def filter_empty_columns(columns): empty_cols = filter(lambda x: x in ("", None), columns) - if columns[-1*len(empty_cols):] == empty_cols: - # filter empty columns if they exist at the end - columns = columns[:-1*len(empty_cols)] - else: - webnotes.msgprint(_("Please make sure that there are no empty columns in the file."), - raise_exception=1) + + if empty_cols: + if columns[-1*len(empty_cols):] == empty_cols: + # filter empty columns if they exist at the end + columns = columns[:-1*len(empty_cols)] + else: + webnotes.msgprint(_("Please make sure that there are no empty columns in the file."), + raise_exception=1) return columns