Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*~
.ve
.ve2
.DS_Store
*.pyc
__pycache__
.pytest_cache/
Expand All @@ -18,6 +19,7 @@ geckodriver.log
ghostdriver.log
cove/lib/org-ids.json
cove/lib/org-ids.json.lock
lib360dataquality.egg-info/
chromedriver/
src/
node_modules/
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Binary file not shown.
3 changes: 3 additions & 0 deletions cove/cove_360/tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def server_url(request, live_server):
'than is supported by this tool (50000). Worksheets with too many rows: '
'\'grants\' (50001 rows), \'grants_2\' (50002 rows)'
], False),
('badfile_missing_max_row.xlsx', [
'',
], True),
("dei_extension.xlsx", [
"do not use the 360Giving Data Standard codelists correctly.",
], True),
Expand Down
11 changes: 6 additions & 5 deletions cove/cove_360/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ def explore_360(request, pk, template='cove_360/explore.html'):
excessive_sheets = {}
try:
workbook = openpyxl.reader.excel.load_workbook(file_name, read_only=True)
excessive_sheets = {
sheetname: workbook[sheetname].max_row
for sheetname in workbook.sheetnames
if workbook[sheetname].max_row > settings.MAX_XLSX_ROWS
}
for sheetname in workbook.sheetnames:
ws = workbook[sheetname]
if not ws.max_row:
ws.calculate_dimension(force=True)
if ws.max_row > settings.MAX_XLSX_ROWS:
excessive_sheets[sheetname] = ws.max_row

except (zipfile.BadZipFile, openpyxl.utils.exceptions.InvalidFileException):
# Exceptions associated with invalid spreadsheets are passed through for cove to handle.
Expand Down
Loading