From 5ec9aaec07dd0b8b9b66239beb3072c2262bd448 Mon Sep 17 00:00:00 2001 From: MatthewHana Date: Tue, 12 Mar 2024 04:41:00 +1100 Subject: [PATCH] Add custom Radicale DAV property getcontentcount This adds a custom Radicale DAV property called 'getcontentcount' which returns the number of entries contained within that collection. --- radicale/app/propfind.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 8cbe4a06..1b8d8b7a 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -272,6 +272,12 @@ def xml_propfind_response( element.text = displayname else: is404 = True + elif tag == xmlutils.make_clark("RADICALE:getcontentcount"): + # Only for internal use by the web interface + if is_collection or is_leaf: + element.text = str(sum(1 for entry in item.get_all())) + else: + is404 = True elif tag == xmlutils.make_clark("D:displayname"): displayname = collection.get_meta("D:displayname") if not displayname and is_leaf: