Skip to content

Commit e2e5196

Browse files
committed
[DATAVIC-559] added helper to detect supported datapusher plus file types
1 parent a9b19b1 commit e2e5196

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ckanext/datavicmain/helpers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,19 @@ def datavic_allowable_parent_orgs(org_id: str = None) -> list[dict[str, Any]]:
690690
continue
691691
orgs.append(org)
692692
return orgs
693+
694+
695+
def datavic_is_datapusher_plus_format(format: str) -> bool:
696+
"""Check if the format is a DataPusher Plus format"""
697+
698+
# Copied and modifed from src/ckanext-datapusher-plus/ckanext/datapusher_plus/plugin.py
699+
# to check for DataPusher Plus formats before submitting.
700+
supported_formats = toolkit.config.get("ckan.datapusher.formats") or toolkit.config.get(
701+
"ckanext.datapusher_plus.formats"
702+
)
703+
if not supported_formats:
704+
supported_formats = [
705+
"csv", "xls", "xlsx", "tsv", "ssv", "tab", "ods",
706+
"geojson", "shp", "qgis", "zip",
707+
]
708+
return format.lower() in supported_formats

0 commit comments

Comments
 (0)