Skip to content

Commit

Permalink
Don't require presence of qgisprojects db service
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Aug 12, 2024
1 parent 1582c7d commit bf18dcb
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/plugins/themes/utils/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,20 @@ def get_projects(app, handler):
db = db_engine.db_engine(db_url)
db_projects = []
sql = sql_text("SELECT schema_name FROM information_schema.schemata")
with db.begin() as connection:
schema_rows = connection.execute(sql).mappings()
for schema_row in schema_rows:
try:
sql = sql_text('SELECT name FROM "{schema}"."qgis_projects"'.format(schema=schema_row["schema_name"]))
with db.begin() as connection:
db_project_rows = connection.execute(sql).mappings()
for db_project_row in db_project_rows:
db_projects.append({"name": db_project_row["name"], "schema": schema_row["schema_name"]})
except Exception as e:
pass
try:
with db.begin() as connection:
schema_rows = connection.execute(sql).mappings()
for schema_row in schema_rows:
try:
sql = sql_text('SELECT name FROM "{schema}"."qgis_projects"'.format(schema=schema_row["schema_name"]))
with db.begin() as connection:
db_project_rows = connection.execute(sql).mappings()
for db_project_row in db_project_rows:
db_projects.append({"name": db_project_row["name"], "schema": schema_row["schema_name"]})
except Exception as e:
pass
except Exception as e:
pass

for project in db_projects:
url = ows_prefix.rstrip("/") + "/pg/" + project["schema"] + "/" + project["name"]
Expand Down

0 comments on commit bf18dcb

Please sign in to comment.