GeoNode / QGISGeoNodePlugin

A QGIS plugin that provides integration with GeoNode
https://geonode.org/QGISGeoNodePlugin/
GNU General Public License v3.0
11 stars 10 forks source link

'LegacyVersion' object has no attribute 'major' on current 3.3.x branch #247

Open gannebamm opened 2 years ago

gannebamm commented 2 years ago

If trying to connect to a recent 3.3.x branch GeoNode instance like https://stable.demo.geonode.org the plugin connection widget will fail with:

AttributeError: 'LegacyVersion' object has no attribute 'major' 
Traceback (most recent call last):
  File "C:\Users/hoedt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_geonode\gui\connection_dialog.py", line 184, in handle_discovery_test
    self.update_connection_details()
  File "C:\Users/hoedt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_geonode\gui\connection_dialog.py", line 231, in update_connection_details
    client: BaseGeonodeClient = apiclient.get_geonode_client(current_settings)
  File "C:\Users/hoedt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_geonode\apiclient\__init__.py", line 13, in get_geonode_client
    class_path = select_client_class_path(connection_settings.geonode_version)
  File "C:\Users/hoedt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_geonode\apiclient\__init__.py", line 24, in select_client_class_path
    if geonode_version.major == 4:
AttributeError: 'LegacyVersion' object has no attribute 'major'

This likely is caused by the non-formal version string displayed, eg. here:

https://stable.demo.geonode.org/version.txt

gannebamm commented 1 year ago

The current master.demo.geonode.org instance does work with the plugin. The error above seems to be specific to the 3.3.x branch or parts of it.

Fifoterra commented 1 year ago

It also happens with Geonode 4.0 for QGIS 3.26 and QGIS 3.22.

Cornacap commented 1 year ago

It also happens with my configuration (QGis 3.22, Geonode 4.0) and Hosting in our intranet.

timlinux commented 1 year ago

It seems the error only gets raised if you paste the URL with the default # that GeoNode adds to the end of the base URL:

image

Removing that should resolve the issue:

image

bjoh-01 commented 9 months ago

It seems the error only gets raised if you paste the URL with the default # that GeoNode adds to the end of the base URL:

image

Removing that should resolve the issue:

image

It does not fix the issue. I think the issue is related to the packager you are using not being PEP440 compliant.

Here's a similar issue:

https://github.com/Digital-Sapphire/PyUpdater/issues/299

vidlb commented 8 months ago

Same here using latest plugin and geonode 4.1.3, this occurs only when testing connection Edit: strange, I ran it a second time with print statements on the geonode_version variable and wasn't able to reproduce twice !