Skip to content

Commit

Permalink
fix ogc_service_url and .bak file format
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément Zitouni authored and manisandro committed Jul 12, 2023
1 parent 1e8b7cb commit d0dd8e0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions plugins/themes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def load_plugin(app, handler):
for setting in ["input_config_path", "qwc2_path", "qgs_resources_path", "info_templates_path"]:
if not os.path.isdir(config.get(setting, "")):
raise RuntimeError("%s is not set or invalid" % setting)
if not config.get("ogc_service_url", None):
raise RuntimeError("ogc_service_url is not set")
if not config.get("ows_prefix", None):
raise RuntimeError("ows_prefix is not set")
if not config.get("default_qgis_server_url", None):
raise RuntimeError("default_qgis_server_url is not set")

Expand Down
3 changes: 1 addition & 2 deletions plugins/themes/controllers/templates_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def __init__(self, app, handler, featureInfoconfig):
self.mapthumb_path = os.path.join(qwc2_path, "assets/img/mapthumbs/")
self.featureInfoconfig = featureInfoconfig
self.info_templates_path = current_handler.config().get("info_templates_path")
ogc_service_url = current_handler.config().get("ogc_service_url")
self.ows_prefix = current_handler.config().get("ows_prefix", urlparse(ogc_service_url).path).rstrip("/") + "/"
self.ows_prefix = urlparse(current_handler.config().get("ows_prefix", "")).path.rstrip("/") + "/"
self.default_qgis_server_url = current_handler.config().get("default_qgis_server_url")
db_engine = current_handler.db_engine()
self.config_models = ConfigModels(db_engine, current_handler.conn_str())
Expand Down
4 changes: 2 additions & 2 deletions plugins/themes/utils/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def save_themesconfig(new_themes_config, app, handler):
e.strerror))
return False

baksuffix = ".bak%s" % datetime.utcnow().strftime("%Y%m%d-%H%M%S")
baksuffix = "%s.bak" % datetime.utcnow().strftime("-%Y%m%d-%H%M%S")
themes_config = tenant_config.get("themesConfig", None)

if isinstance(themes_config, str):
Expand Down Expand Up @@ -143,7 +143,7 @@ def save_featureinfo_config(new_featureinfo_config, app, handler):
app.logger.error("Error reading tenantConfig.json: {}".format(e.strerror))
return False

baksuffix = ".bak%s" % datetime.utcnow().strftime("%Y%m%d-%H%M%S")
baksuffix = "%s.bak" % datetime.utcnow().strftime("-%Y%m%d-%H%M%S")
services = tenant_config.get("services", [])

for service in services:
Expand Down
4 changes: 0 additions & 4 deletions schemas/qwc-admin-gui.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@
"description": "The path to the html info templates. Required for 'themes' plugin.",
"type": "string"
},
"ogc_service_url": {
"description": "The OGC service URL. Required for 'themes' plugin. Deprecated, use ows_prefix instead.",
"type": "string"
},
"ows_prefix": {
"description": "The OGC service URL path prefix, i.e. /ows. Required for 'themes' plugin.",
"type": "string"
Expand Down

0 comments on commit d0dd8e0

Please sign in to comment.