Skip to content

Commit

Permalink
add props parameter to search function
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain Lemasson authored and tobixen committed Jul 18, 2023
1 parent a08d839 commit 4ae52de
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions caldav/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@ def search(
include_completed=False,
sort_keys=(),
split_expanded=True,
props = None,
**kwargs
):
"""Creates an XML query, does a REPORT request towards the
Expand Down Expand Up @@ -1049,13 +1050,13 @@ def search(

if not xml:
(xml, comp_class) = self.build_search_xml_query(
comp_class=comp_class, todo=todo, **kwargs
comp_class=comp_class, todo=todo, props=props, **kwargs
)
elif kwargs:
raise error.ConsistencyError(
"Inconsistent usage parameters: xml together with other search options"
)
(response, objects) = self._request_report_build_resultlist(xml, comp_class)
(response, objects) = self._request_report_build_resultlist(xml, comp_class, props=props)

if kwargs.get("expand", False):
## expand can only be used together with start and end.
Expand Down Expand Up @@ -1140,6 +1141,7 @@ def build_search_xml_query(
expand=None,
start=None,
end=None,
props=None,
**kwargs
):
"""This method will produce a caldav search query as an etree object.
Expand All @@ -1159,8 +1161,11 @@ def build_search_xml_query(
if not start or not end:
raise error.ReportError("can't expand without a date range")
data += cdav.Expand(start, end)
prop = dav.Prop() + data

if props is None:
props_ = [data]
else:
props_ = [data] + props
prop = dav.Prop() + props_
vcalendar = cdav.CompFilter("VCALENDAR")

comp_filter = None
Expand Down

0 comments on commit 4ae52de

Please sign in to comment.