From 82b91946a657b73255c33c0f25fe11c50599592e Mon Sep 17 00:00:00 2001 From: Valyrian-Code Date: Sun, 5 Jul 2026 00:25:00 +0530 Subject: [PATCH 1/2] t.list: check for temporal databases in all accessible mapsets --- temporal/t.list/t.list.py | 14 ++++++++++---- temporal/t.list/tests/test_t_list.py | 11 +++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/temporal/t.list/t.list.py b/temporal/t.list/t.list.py index 97ef875795a..b761c9936ab 100755 --- a/temporal/t.list/t.list.py +++ b/temporal/t.list/t.list.py @@ -152,15 +152,21 @@ def main(): tools = Tools() - conn = tools.t_connect(flags="p", format="json", mapset=".") + # One entry per mapset in the current search path + conn = tools.t_connect(flags="p", format="json") - db_exists = conn[0]["driver"] and conn[0]["database"] + db_exists = any( + mapset_conn["driver"] and mapset_conn["database"] for mapset_conn in conn + ) - # if no connection is found + # if no connection is found in any accessible mapset if not db_exists: if output_format == "plain": gs.message( - _("No temporal database exists in this mapset. No datasets to list.") + _( + "No temporal database exists in any accessible mapset. " + "No datasets to list." + ) ) with ( open(outpath, "w") diff --git a/temporal/t.list/tests/test_t_list.py b/temporal/t.list/tests/test_t_list.py index 6ce2f2356bd..60951018f2d 100644 --- a/temporal/t.list/tests/test_t_list.py +++ b/temporal/t.list/tests/test_t_list.py @@ -4,6 +4,7 @@ import pytest +from grass.experimental import TemporaryMapsetSession from grass.tools import Tools @@ -151,3 +152,13 @@ def test_t_list_empty_database(empty_session): result = tools.t_connect(flags="p", format="json", mapset=".") db_exist = result[0]["driver"] and result[0]["database"] assert not db_exist + + +def test_t_list_from_mapset_without_temporal_database(space_time_dataset): + """Datasets in accessible mapsets are listed even when the current mapset + has no temporal database (https://github.com/OSGeo/grass/issues/7622).""" + with TemporaryMapsetSession(env=space_time_dataset.session.env) as mapset_session: + tools = Tools(session=mapset_session) + result = tools.t_list(type="strds", format="json") + names = [record["name"] for record in result.json] + assert space_time_dataset.name in names From 8d824edfbf127acd489858c85b283d8d100b1044 Mon Sep 17 00:00:00 2001 From: Valyrian-Code Date: Wed, 8 Jul 2026 11:28:25 +0530 Subject: [PATCH 2/2] t.list: keep only the regression test, the fix lands in #7631 --- temporal/t.list/t.list.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/temporal/t.list/t.list.py b/temporal/t.list/t.list.py index b761c9936ab..97ef875795a 100755 --- a/temporal/t.list/t.list.py +++ b/temporal/t.list/t.list.py @@ -152,21 +152,15 @@ def main(): tools = Tools() - # One entry per mapset in the current search path - conn = tools.t_connect(flags="p", format="json") + conn = tools.t_connect(flags="p", format="json", mapset=".") - db_exists = any( - mapset_conn["driver"] and mapset_conn["database"] for mapset_conn in conn - ) + db_exists = conn[0]["driver"] and conn[0]["database"] - # if no connection is found in any accessible mapset + # if no connection is found if not db_exists: if output_format == "plain": gs.message( - _( - "No temporal database exists in any accessible mapset. " - "No datasets to list." - ) + _("No temporal database exists in this mapset. No datasets to list.") ) with ( open(outpath, "w")