mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Show proper message on empty Excel import, rather than a code error
Summary:
- Previously showed "UnboundLocalError". Now will show:
Import failed: Failed to parse Excel file.
Error: No tables found (1 empty tables skipped)
- Also fix logging for import code
Test Plan: Added a test case
Reviewers: georgegevoian
Reviewed By: georgegevoian
Differential Revision: https://phab.getgrist.com/D3396
This commit is contained in:
@@ -7,6 +7,7 @@ import sys
|
||||
sys.path.append('thirdparty')
|
||||
# pylint: disable=wrong-import-position
|
||||
|
||||
import logging
|
||||
import marshal
|
||||
import functools
|
||||
|
||||
@@ -25,6 +26,9 @@ from imports.register import register_import_parsers
|
||||
import logger
|
||||
log = logger.Logger(__name__, logger.INFO)
|
||||
|
||||
# Configure logging module to behave similarly to logger. (It may be OK to get rid of logger.)
|
||||
logging.basicConfig(format="[%(levelname)s] [%(name)s] %(message)s")
|
||||
|
||||
def table_data_from_db(table_name, table_data_repr):
|
||||
if table_data_repr is None:
|
||||
return actions.TableData(table_name, [], {})
|
||||
|
||||
Reference in New Issue
Block a user