mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-12 20:30:57 +00:00
Better freebusy occurrence limit handling and added documentation
This commit is contained in:
parent
3cba4b32a3
commit
408a03a3c0
4 changed files with 35 additions and 1 deletions
|
@ -117,10 +117,18 @@ def free_busy_report(base_prefix: str, path: str, xml_request: Optional[ET.Eleme
|
|||
|
||||
# TODO: coalesce overlapping periods
|
||||
|
||||
if max_occurrence > 0:
|
||||
n_occurrences = max_occurrence+1
|
||||
else:
|
||||
n_occurrences = 0
|
||||
occurrences = radicale_filter.time_range_fill(item.vobject_item,
|
||||
time_range_element,
|
||||
"VEVENT",
|
||||
n=max_occurrence)
|
||||
n=n_occurrences)
|
||||
if len(occurrences) >= max_occurrence:
|
||||
raise ValueError("FREEBUSY occurrences limit of {} hit"
|
||||
.format(max_occurrence))
|
||||
|
||||
for occurrence in occurrences:
|
||||
vfb = cal.add('vfreebusy')
|
||||
vfb.add('dtstamp').value = item.vobject_item.vevent.dtstamp.value
|
||||
|
|
|
@ -1392,6 +1392,14 @@ permissions: RrWw""")
|
|||
types[fbtype_val] += 1
|
||||
assert types == {'BUSY': 2, 'FREE': 1}
|
||||
|
||||
# Test max_freebusy_occurrence limit
|
||||
self.configure({"reporting": {"max_freebusy_occurrence": 1}})
|
||||
code, responses = self.report(calendar_path, """\
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<C:time-range start="20130901T140000Z" end="20130908T220000Z"/>
|
||||
</C:free-busy-query>""", 400, is_xml=False)
|
||||
|
||||
def _report_sync_token(
|
||||
self, calendar_path: str, sync_token: Optional[str] = None
|
||||
) -> Tuple[str, RESPONSES]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue