diff --git a/src/agents/store/object-model.c b/src/agents/store/object-model.c index e1ac6dd..b7ff089 100644 --- a/src/agents/store/object-model.c +++ b/src/agents/store/object-model.c @@ -975,6 +975,7 @@ StoreObjectIterLinks(StoreClient *client, StoreObject *document, BOOL reverse) query = "l to ?1"; QueryBuilderStart(&builder); + QueryBuilderSetOutputMode(&builder, MODE_LIST); QueryBuilderSetQuerySafe(&builder, query); diff --git a/src/apps/storetool/bongo/storetool/CalendarCommands.py b/src/apps/storetool/bongo/storetool/CalendarCommands.py index 780508e..ab0f40e 100644 --- a/src/apps/storetool/bongo/storetool/CalendarCommands.py +++ b/src/apps/storetool/bongo/storetool/CalendarCommands.py @@ -109,11 +109,13 @@ class CalendarEventsCommand(Command): print("Could not find calendar named '%s'" % args[0]) return - events = list(store.Events(cal.uid, ["nmap.document", - "nmap.event.calendars"])) + events = list(store.Events(cal.uid)) for event in events: - jsob = simplejson.loads(event.props["nmap.document"].strip()) + payload = store.Read(event.uid) + if isinstance(payload, bytes): + payload = payload.decode("utf-8") + jsob = simplejson.loads(payload.strip()) comp = jsob["components"][0] summary = _json_component_value(comp, "summary") diff --git a/src/apps/storetool/tests/test_python3_runtime.py b/src/apps/storetool/tests/test_python3_runtime.py index 00bb5ea..f532d8f 100644 --- a/src/apps/storetool/tests/test_python3_runtime.py +++ b/src/apps/storetool/tests/test_python3_runtime.py @@ -129,6 +129,30 @@ class Python3RuntimeTests(unittest.TestCase): store.Read.assert_called_once_with(contact.uid) self.assertIn("\u00c4nne Example", output.call_args.args[0]) + def test_calendar_listing_reads_event_document_bodies(self): + calendar = SimpleNamespace(uid="calendar-guid") + event = SimpleNamespace(uid="event-guid") + store = mock.Mock() + store.List.return_value = [ + SimpleNamespace(filename="/calendars/Holidays", + uid=calendar.uid)] + store.Events.return_value = [event] + store.Read.return_value = ( + b'{"components":[{"summary":{"value":"Holiday"},' + b'"dtstart":{"value":"20260724"},' + b'"dtend":{"value":"20260725"}}]}') + + from bongo.storetool.CalendarCommands import CalendarEventsCommand + command = CalendarEventsCommand() + with mock.patch( + "bongo.storetool.CalendarCommands.connect_store", + return_value=store), \ + mock.patch("builtins.print"): + command.Run(SimpleNamespace(), ["Holidays"]) + + store.Events.assert_called_once_with(calendar.uid) + store.Read.assert_called_once_with(event.uid) + def test_console_table_and_unicode_template_are_text(self): self.assertIsInstance(wrap("Grüße 世界", width=8), str) self.assertEqual(table.format_table(["Name"], [["Müller"]]),