Explorar el Código

Merge pull request #1764 from pbiering/check-fix-1758

Fix for 1758
Peter Bieringer hace 10 meses
padre
commit
7dda907582
Se han modificado 3 ficheros con 19 adiciones y 6 borrados
  1. 3 2
      CHANGELOG.md
  2. 5 4
      radicale/item/filter.py
  3. 11 0
      radicale/tests/test_base.py

+ 3 - 2
CHANGELOG.md

@@ -1,7 +1,8 @@
 # Changelog
 
 ## 3.5.2.dev
-* Adjust: [auth] ldap: use _ldap_user_attr either first element of list or directly 
+* Adjust: [auth] ldap: use ldap_user_attr either first element of list or directly 
+* Fix: use value of property for time range filter
 
 ## 3.5.1
 
@@ -10,7 +11,7 @@
 * Extend: [storage] hook supports now placeholder for "cwd" and "path" (and catches unsupported placeholders)
 * Fix: location of lock file for in case of dedicated cache folder is activated
 * Extend: log and create base folders if not existing during startup
-* Adjust: [auth] ldap: use _ldap_user_attr as string
+* Adjust: [auth] ldap: use ldap_user_attr as string
 
 ## 3.5.0
 

+ 5 - 4
radicale/item/filter.py

@@ -3,7 +3,8 @@
 # Copyright © 2008 Pascal Halter
 # Copyright © 2008-2015 Guillaume Ayoub
 # Copyright © 2017-2021 Unrud <unrud@outlook.com>
-# Copyright © 2024-2024 Peter Bieringer <pb@bieringer.de>
+# Copyright © 2023-2024 Ray <ray@react0r.com>
+# Copyright © 2024-2025 Peter Bieringer <pb@bieringer.de>
 #
 # This library is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -475,9 +476,9 @@ def visit_time_ranges(vobject_item: vobject.base.Component, child_name: str,
     else:
         # Match a property
         child = getattr(vobject_item, child_name.lower())
-        if isinstance(child, date):
-            child_is_datetime = isinstance(child, datetime)
-            child = date_to_datetime(child)
+        if isinstance(child.value, date):
+            child_is_datetime = isinstance(child.value, datetime)
+            child = date_to_datetime(child.value)
             if child_is_datetime:
                 range_fn(child, child + SECOND, False)
             else:

+ 11 - 0
radicale/tests/test_base.py

@@ -1304,6 +1304,17 @@ permissions: RrWw""")
 </C:comp-filter>"""], "todo", items=range(1, 9))
         assert "/calendar.ics/todo7.ics" in answer
 
+    def test_time_range_filter_todos_completed(self) -> None:
+        answer = self._test_filter(["""\
+<C:comp-filter name="VCALENDAR">
+  <C:comp-filter name="VTODO">
+    <C:prop-filter name="COMPLETED">
+      <C:time-range start="20130918T000000Z" end="20130922T000000Z"/>
+    </C:prop-filter>
+  </C:comp-filter>
+</C:comp-filter>"""], "todo", items=range(1, 9))
+        assert "/calendar.ics/todo6.ics" in answer
+
     def test_time_range_filter_todos_rrule(self) -> None:
         """Report request with time-range filter on todos with rrules."""
         answer = self._test_filter(["""\