Skip to content

[Draft] Upgrade a GeoNode 4 to 5

mattiagiupponi edited this page Oct 22, 2024 · 2 revisions

Importer

  • The importer has been merged inside GeoNode core, For geonode-projects the depencency with the geonode-importer must be removed

Update Handlers configuration to work with GeoNode 5

With the issue #12657 a new configuration for serving the configuration for the client is changed, this required some refactor on the handlers in detail:

  • The internal ACTIONS attribute of the handler (the one which lists the tasks to be followed) is renamed into TASKS
  • The upload endpoint now requires an action parameter (previously source) which is used to get the tasks list
  • The source parameter of the ExecutionRequest is dropped
  • If the handler can manage the replace or overwrite_existing_data the key replace must be available in the TASKS list
  • The IMPORT key in the TASKS has been renamed into UPLOAD

So the expecting tasks list for an handler is something similar to this:

TASKS = {
    exa.UPLOAD.value: (
        "start_import",
        "geonode.upload.import_resource",
        "geonode.upload.publish_resource",
        "geonode.upload.create_geonode_resource",
    ),
    exa.COPY.value: (
        "start_copy",
        "geonode.upload.copy_dynamic_model",
        "geonode.upload.copy_geonode_data_table",
        "geonode.upload.publish_resource",
        "geonode.upload.copy_geonode_resource",
    ),
    ira.ROLLBACK.value: (
        "start_rollback",
        "geonode.upload.rollback",
    ),
    ira.REPLACE.value: (
        "start_import",
        "geonode.upload.import_resource",
        "geonode.upload.publish_resource",
        "geonode.upload.create_geonode_resource",
    ),
}
  • The supported_file_extension_config now expects a new format which must be follow. The key ext and optional are dropped
  • New key named formats has been added, is a list of dictionary with three keys: label (the label to be displayed in UI), required_ext which rappresent the mandatory extension for the FE and optional_ext.
  • New actions key is added, contains all the ACTIONS available for the selected handler
  • format has been renamed into type For example:

Before:

@property
def supported_file_extension_config(self):
    return {
        "id": "geojson",
        "label": "GeoJSON",
        "format": "vector",
        "ext": ["json", "geojson"],
        "optional": ["xml", "sld"],
    }

After:

@property
def supported_file_extension_config(self):
    return {
        "id": "geojson",
        "formats": [
            {
                "label": "GeoJSON",
                "required_ext": ["geojson"],
                "optional_ext": ["sld", "xml"],
            },
            {
                "label": "GeoJSON",
                "required_ext": ["json"],
                "optional_ext": ["sld", "xml"],
            },
        ],
        "actions": list(self.TASKS.keys()),
        "type": "vector",
    }
  • (Formats configurations...)
Clone this wiki locally