diff --git a/pygeoapi/api/tiles.py b/pygeoapi/api/tiles.py index afdde22b1..cb08459f5 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 diff --git a/pygeoapi/process/manager/mongodb_.py b/pygeoapi/process/manager/mongodb_.py index 06e6d909a..5479bea78 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 cfd63eafb..180d6ba28 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)}