From d04b5e8dc4743890954504c265f0f840f9e97aa4 Mon Sep 17 00:00:00 2001 From: C1-BA-B1-F3 Date: Sat, 3 Oct 2026 11:31:23 +0800 Subject: [PATCH 1/2] fix(process manager): apply limit and offset in get_jobs PostgreSQL and MongoDB managers ignored the limit and offset parameters, returning all jobs regardless of the query string. Apply offset before limit in both backends, matching the existing TinyDB behaviour. Fixes #2426 --- pygeoapi/process/manager/mongodb_.py | 10 ++++++++-- pygeoapi/process/manager/postgresql.py | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pygeoapi/process/manager/mongodb_.py b/pygeoapi/process/manager/mongodb_.py index 06e6d909ad..5479bea78a 100644 --- a/pygeoapi/process/manager/mongodb_.py +++ b/pygeoapi/process/manager/mongodb_.py @@ -79,9 +79,15 @@ def get_jobs(self, status=None, limit=None, offset=None): database = self.db.job_manager_pygeoapi collection = database.jobs if status is not None: - jobs = list(collection.find({}, {"status": status})) + query = {"status": status} else: - jobs = list(collection.find({})) + query = {} + cursor = collection.find(query) + if offset: + cursor = cursor.skip(offset) + if limit: + cursor = cursor.limit(limit) + jobs = list(cursor) LOGGER.info("JOBMANAGER - MongoDB jobs queried") return { 'jobs': jobs, diff --git a/pygeoapi/process/manager/postgresql.py b/pygeoapi/process/manager/postgresql.py index cfd63eafb8..180d6ba282 100644 --- a/pygeoapi/process/manager/postgresql.py +++ b/pygeoapi/process/manager/postgresql.py @@ -133,6 +133,11 @@ def get_jobs( if status is not None: results = results.filter(self.c.status == status.value) + if offset: + results = results.offset(offset) + if limit: + results = results.limit(limit) + jobs = [r._asdict() for r in results.all()] return {'jobs': jobs, 'numberMatched': len(jobs)} From 36e9016ef59dd695c698cb41c7a3bbf0fb9af468 Mon Sep 17 00:00:00 2001 From: C1-BA-B1-F3 Date: Sat, 3 Oct 2026 12:19:58 +0800 Subject: [PATCH 2/2] fix(tiles): pass server templates to render_j2_template for TMS endpoints The tilematrixsets and tilematrixset HTML handlers passed api.tpl_config as the template configuration, but that dict carries the full server config (including 'server') and lacks the 'path' key that render_j2_template expects. The lookup therefore always fell back to the default templates, ignoring any custom theme. Pass api.config['server']['templates'] instead, matching every other render_j2_template call site. Fixes #2422 --- pygeoapi/api/tiles.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pygeoapi/api/tiles.py b/pygeoapi/api/tiles.py index afdde22b1f..cb08459f5b 100644 --- a/pygeoapi/api/tiles.py +++ b/pygeoapi/api/tiles.py @@ -389,7 +389,8 @@ def tilematrixsets(api: API, }] if request.format == F_HTML: # render - content = render_j2_template(api.tpl_config, api.tpl_config, + content = render_j2_template(api.tpl_config, + api.config['server']['templates'], 'tilematrixsets/index.html', tms, request.locale) return headers, HTTPStatus.OK, content @@ -436,7 +437,8 @@ def tilematrixset(api: API, } if request.format == F_HTML: # render - content = render_j2_template(api.tpl_config, api.tpl_config, + content = render_j2_template(api.tpl_config, + api.config['server']['templates'], 'tilematrixsets/tilematrixset.html', tms, request.locale) return headers, HTTPStatus.OK, content