Skip to content

Commit 924b6f4

Browse files
[Fixes #271] XML and SLD raise error during import (#272)
* [Fixes #271] XML and SLD raise error during import
1 parent bec2c22 commit 924b6f4

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed

.github/workflows/runtests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717
- name: Start containers
18-
run: docker-compose -f "docker-compose-test.yaml" up -d --build
18+
run: docker compose -f "docker-compose-test.yaml" up -d --build
1919
- name: Run django entrypoint
2020
run: docker exec django4importer /bin/sh -c "sh /usr/src/importer/entrypoint_test.sh"
2121
- name: Run geonode-importer tests
@@ -34,4 +34,4 @@ jobs:
3434
path: python-coverage-comment-action.txt
3535
- name: Stop containers
3636
if: always()
37-
run: docker-compose -f "docker-compose-test.yaml" down
37+
run: docker compose -f "docker-compose-test.yaml" down

importer/handlers/apps.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,44 +34,7 @@ def run_setup_hooks(*args, **kwargs):
3434
if import_string(module_path)().supported_file_extension_config
3535
]
3636
# injecting the new config required for FE
37-
supported_type = [
38-
{
39-
"id": "xml",
40-
"label": "XML Metadata File",
41-
"format": "metadata",
42-
"ext": ["xml"],
43-
"mimeType": ["application/json"],
44-
"needsFiles": [
45-
"shp",
46-
"prj",
47-
"dbf",
48-
"shx",
49-
"csv",
50-
"tiff",
51-
"zip",
52-
"sld",
53-
"geojson",
54-
],
55-
},
56-
{
57-
"id": "sld",
58-
"label": "Styled Layer Descriptor (SLD)",
59-
"format": "metadata",
60-
"ext": ["sld"],
61-
"mimeType": ["application/json"],
62-
"needsFiles": [
63-
"shp",
64-
"prj",
65-
"dbf",
66-
"shx",
67-
"csv",
68-
"tiff",
69-
"zip",
70-
"xml",
71-
"geojson",
72-
],
73-
},
74-
]
37+
supported_type = []
7538
supported_type.extend(_available_settings)
7639
if not getattr(settings, "ADDITIONAL_DATASET_FILE_TYPES", None):
7740
setattr(settings, "ADDITIONAL_DATASET_FILE_TYPES", supported_type)

importer/handlers/common/metadata.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ def has_serializer(data) -> bool:
3535
return MetadataFileSerializer
3636
return False
3737

38-
@property
39-
def supported_file_extension_config(self):
40-
return {}
41-
4238
@staticmethod
4339
def extract_params_from_data(_data, action=None):
4440
"""

importer/handlers/sld/handler.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ class SLDFileHandler(MetadataFileHandler):
1313
Handler to import SLD files into GeoNode data db
1414
It must provide the task_lists required to comple the upload
1515
"""
16+
@property
17+
def supported_file_extension_config(self):
18+
return {
19+
"id": "sld",
20+
"label": "Styled Layer Descriptor (SLD)",
21+
"format": "metadata",
22+
"ext": ["sld"],
23+
"mimeType": ["application/json"],
24+
"needsFiles": [
25+
"shp",
26+
"prj",
27+
"dbf",
28+
"shx",
29+
"csv",
30+
"tiff",
31+
"zip",
32+
"xml",
33+
"geojson",
34+
],
35+
}
1636

1737
@staticmethod
1838
def can_handle(_data) -> bool:

importer/handlers/xml/handler.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ class XMLFileHandler(MetadataFileHandler):
1313
Handler to import XML files into GeoNode data db
1414
It must provide the task_lists required to comple the upload
1515
"""
16+
@property
17+
def supported_file_extension_config(self):
18+
return {
19+
"id": "xml",
20+
"label": "XML Metadata File",
21+
"format": "metadata",
22+
"ext": ["xml"],
23+
"mimeType": ["application/json"],
24+
"needsFiles": [
25+
"shp",
26+
"prj",
27+
"dbf",
28+
"shx",
29+
"csv",
30+
"tiff",
31+
"zip",
32+
"sld",
33+
"geojson",
34+
],
35+
}
1636

1737
@staticmethod
1838
def can_handle(_data) -> bool:

0 commit comments

Comments
 (0)