Skip to content

Commit

Permalink
Move the OGC make project valid up in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed May 30, 2024
1 parent 85b7848 commit 47e4d89
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3497,6 +3497,26 @@ def project_config_file(
self, lwc_version: LwcVersions, with_gui: bool = True, check_server=True, ignore_error=False
) -> Optional[Dict]:
""" Get the JSON CFG content. """

if lwc_version >= LwcVersions.Lizmap_3_6:
LOGGER.info(
'Lizmap Web Client target version {}, let\'s try to make the project valid.'.format(
lwc_version.value)
)
# Set shortnames if it's not set
ogc_projet_validity = OgcProjectValidity(self.project)
ogc_projet_validity.add_shortnames()
ogc_projet_validity.set_project_short_name()

validator = QgsProjectServerValidator()
valid, results = validator.validate(self.project)
LOGGER.info(f"Project has been detected : {'VALID' if valid else 'NOT valid'} according to OGC validation.")
else:
LOGGER.info(
"Lizmap Web Client target version {}, we do not update the project for OGC validity.".format(
lwc_version.value)
)

if not self.check_project(lwc_version, with_gui, check_server, ignore_error):
# Some blocking issues, we can not continue
return None
Expand Down Expand Up @@ -4319,25 +4339,6 @@ def save_cfg_file(
), QMessageBox.Ok)
return False

if lwc_version >= LwcVersions.Lizmap_3_6:
LOGGER.info(
'Lizmap Web Client target version {}, let\'s try to make the project valid.'.format(
lwc_version.value)
)
# Set shortnames if it's not set
ogc_projet_validity = OgcProjectValidity(self.project)
ogc_projet_validity.add_shortnames()
ogc_projet_validity.set_project_short_name()

validator = QgsProjectServerValidator()
valid, results = validator.validate(self.project)
LOGGER.info(f"Project has been detected : {'VALID' if valid else 'NOT valid'} according to OGC validation.")
else:
LOGGER.info(
"Lizmap Web Client target version {}, we do not update the project for OGC validity.".format(
lwc_version.value)
)

# global project option checking
is_valid, message = self.check_global_project_options()
if not is_valid:
Expand Down

0 comments on commit 47e4d89

Please sign in to comment.