Bug report #21093
GeoNode API requests require a stronger minor version parsing
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Alexander Bruy | ||
Category: | Data Provider/GeoNode | ||
Affected QGIS version: | 3.5(master) | Regression?: | No |
Operating System: | Easy fix?: | Yes | |
Pull Request or Patch supplied: | Yes | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 28911 |
Description
Currently QGIS parses GeoNode's version with a simple .toInt(): https://github.com/qgis/QGIS/blob/master/src/core/geocms/geonode/qgsgeonoderequest.cpp#L275
but GeoNode adds more informations to the minor version, for instance "rc" for a release candidate. This makes the parsing fail and thus layers are not fetched.
As an example look at the "geonode_version" field on the master demo instance: http://master.demo.geonode.org/api/layers/
Probably a simple regex would be fine to extract only the first numbers from the minor version part.
Related issues
Associated revisions
History
#1 Updated by Giovanni Allegri almost 6 years ago
- Assignee set to Tim Sutton
#2 Updated by Giovanni Allegri almost 6 years ago
- Priority changed from Normal to High
#3 Updated by Giovanni Manghi almost 6 years ago
- Priority changed from High to Normal
#4 Updated by Giovanni Allegri almost 6 years ago
Giovanni,
if the priority is global ok, I agree there are issues more relevant then this.
I thought priority was scoped to the category the issue was assigned to. In that case it's high because the current GeoNode provider is unasable with the current release of GeoNode.
#5 Updated by Giovanni Manghi almost 6 years ago
Giovanni Allegri wrote:
Giovanni,
if the priority is global ok, I agree there are issues more relevant then this.
I thought priority was scoped to the category the issue was assigned to. In that case it's high because the current GeoNode provider is unasable with the current release of GeoNode.
The rationale we use is: "high" is for issues causing crashes or data corruption or that are regressions. Does this issue fit it?
#6 Updated by Giovanni Allegri almost 6 years ago
ok then this is not the case. This bug simply makes the provider unusable.
#7 Updated by Robert Ward almost 6 years ago
This bug is a bit of a red herring, yes it is a problem however if the code is made to correctly parse the minor version then no GeoNode layers are returned because the wrong code is executed to parse the json response.
The following is what is returned from http://master.demo.geonode.org/api/layers/
{"geonode_version": "2.10rc4", "meta": {"limit": 1000, "next": null, "offset": 0, "previous": null, "total_count": 1}, "objects": [{"abstract": "No abstract provided", "alternate": "geonode:ukcs_coast", "bbox_x0": "-22.756981842778200", "bbox_x1": "11.999999997221800", "bbox_y0": "47.999999998915300", "bbox_y1": "64.000000008915300", "constraints_other": null, "csw_type": "dataset", "csw_wkt_geometry": "POLYGON((-22.7595163995 47.9987371688,-22.7595163995 63.9997273802,11.9989578796 63.9997273802,11.9989578796 47.9987371688,-22.7595163995 47.9987371688))", "data_quality_statement": null, "date": "2019-01-28T02:39:50.810622", "date_type": "publication", "default_style": "/api/styles/1/", "detail_url": "/layers/geonode:ukcs_coast", "dirty_state": false, "edition": null, "geogig_link": null, "gtype": "MultiPolygon", "has_time": false, "id": 1, "is_approved": true, "is_published": true, "keywords": ["features", "ukcs_coast"], "language": "eng", "license": 1, "maintenance_frequency": null, "name": "ukcs_coast", "online": true, "owner__username": "ward_r", "owner_name": "ward_r", "popular_count": 0, "purpose": null, "rating": 0, "regions": ["Global"], "resource_uri": "/api/layers/1/", "restriction_code_type": null, "share_count": 0, "site_url": "http://master.demo.geonode.org/", "spatial_representation_type": null, "srid": "EPSG:4230", "store_type": "dataStore", "supplemental_information": "No information provided", "temporal_extent_end": null, "temporal_extent_start": null, "thumbnail_url": "http://master.demo.geonode.org/uploaded/thumbs/layer-46d3505a-22d8-11e9-922b-0242ac120006-thumb.png", "title": "ukcs_coast", "typename": "geonode:ukcs_coast", "uuid": "46d3505a-22d8-11e9-922b-0242ac120006"}]}
Based on a version number of 2.10 the code executed expects to see values for the key 'links' which is not present in the above response. If the code is forced to execute the other code block where the expected version is 2.6 then the layers are correctly parsed. I have a GeoNode 2.8 instance that follows the same pattern and so GeoNode layers never appear in QGIS as they should do.
I have a working patch that parses the GeoNode json response based on the contents rather than the version numbers. It appears the GeoNode documentation does not state what the responses format should be let alone how it has changed over the versions. If somebody could point me at a GeoNode instance to provide the alternative json response I can create a unit test and create a pull request to GeoNode functionality working again in QGIS.
#8 Updated by Giovanni Allegri almost 6 years ago
The issue of missing links has been addressed recently (https://github.com/GeoNode/geonode/commit/704b8d55363a8f1489fdb62d2501f7c85dc922e8) but master demo is not updated yet.
You can test it using our own dev deployment with the fix applied: http://dev.geonode.geo-solutions.it/api/layers/
#9 Updated by Alexander Bruy almost 6 years ago
- Related to Bug report #21140: Failed Connected in Geonode Instance added
#10 Updated by Alexander Bruy over 5 years ago
- Status changed from Open to In Progress
- Pull Request or Patch supplied changed from No to Yes
- Assignee changed from Tim Sutton to Alexander Bruy
#11 Updated by Alexander Bruy over 5 years ago
- Related to deleted (Bug report #21140: Failed Connected in Geonode Instance)
#12 Updated by Alexander Bruy over 5 years ago
- Duplicated by Bug report #21140: Failed Connected in Geonode Instance added
#13 Updated by Alexander Bruy over 5 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|440f8d4cbb655942f868dde9ab23b0cc5d69c3b2.
#14 Updated by Tim Sutton over 5 years ago
Alexander Bruy wrote:
Applied in changeset qgis|440f8d4cbb655942f868dde9ab23b0cc5d69c3b2.
Thanks very much @Alex Bruy!
#15 Updated by Giovanni Allegri over 5 years ago
Thanks also from me ;)
#16 Updated by Alexander Bruy over 5 years ago
- Resolution set to fixed/implemented