[Draft] Upgrade a GeoNode 4 to 5 - GeoNode/geonode GitHub Wiki
Importer
- The importer has been merged inside GeoNode core, For geonode-projects the depencency with the geonode-importer must be removed
Update custom 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
ACTIONSattribute of the handler (the one which lists the tasks to be followed) is renamed intoTASKS - The upload endpoint now requires an
actionparameter (previously source) which is used to get the tasks list - The
sourceparameter of theExecutionRequestis dropped - If the handler can manage the
replaceoroverwrite_existing_datathe keyreplacemust be available in theTASKSlist - The
IMPORTkey in theTASKShas been renamed intoUPLOAD
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_confignow expects a new format which must be follow. The keyextandoptionalare dropped - New key named
formatshas been added, is a list of dictionary with three keys:label(the label to be displayed in UI),required_extwhich rappresent the mandatory extension for the FE andoptional_ext. - New
actionskey is added, contains all the ACTIONS available for the selected handler formathas been renamed intotypeFor 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...)