Skip to content

Commit 24d0d1f

Browse files
committed
Fix for free-busy fbtype statuses
1 parent 96e5f68 commit 24d0d1f

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master
44

5+
## 3.2.0.a2
6+
7+
* Fix for free-busy `fbtype` statuses
8+
59
## 3.2.0.a1
610

711
* Added free-busy report

radicale/app/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ def free_busy_report(base_prefix: str, path: str, xml_request: Optional[ET.Eleme
8888

8989
fbtype = None
9090
if item.component_name == 'VEVENT':
91-
transp = getattr(item.vobject_item, 'transp', None)
91+
transp = getattr(item.vobject_item.vevent, 'transp', None)
9292
if transp and transp.value != 'OPAQUE':
9393
continue
9494

95-
status = getattr(item.vobject_item, 'status', None)
95+
status = getattr(item.vobject_item.vevent, 'status', None)
9696
if not status or status.value == 'CONFIRMED':
9797
fbtype = 'BUSY'
9898
elif status.value == 'CANCELLED':

radicale/tests/static/event10.ics

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
BEGIN:VCALENDAR
2+
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
3+
VERSION:2.0
4+
BEGIN:VTIMEZONE
5+
TZID:Europe/Paris
6+
X-LIC-LOCATION:Europe/Paris
7+
BEGIN:DAYLIGHT
8+
TZOFFSETFROM:+0100
9+
TZOFFSETTO:+0200
10+
TZNAME:CEST
11+
DTSTART:19700329T020000
12+
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
13+
END:DAYLIGHT
14+
BEGIN:STANDARD
15+
TZOFFSETFROM:+0200
16+
TZOFFSETTO:+0100
17+
TZNAME:CET
18+
DTSTART:19701025T030000
19+
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
20+
END:STANDARD
21+
END:VTIMEZONE
22+
BEGIN:VEVENT
23+
CREATED:20130902T150157Z
24+
LAST-MODIFIED:20130902T150158Z
25+
DTSTAMP:20130902T150158Z
26+
UID:event10
27+
SUMMARY:Event
28+
CATEGORIES:some_category1,another_category2
29+
ORGANIZER:mailto:[email protected]
30+
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=Jane Doe:MAILTO:[email protected]
31+
ATTENDEE;ROLE=REQ-PARTICIPANT;DELEGATED-FROM="MAILTO:[email protected]";PARTSTAT=ACCEPTED;CN=John Doe:MAILTO:[email protected]
32+
DTSTART;TZID=Europe/Paris:20130901T180000
33+
DTEND;TZID=Europe/Paris:20130901T190000
34+
STATUS:CANCELLED
35+
END:VEVENT
36+
END:VCALENDAR

radicale/tests/test_base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ def test_report_free_busy(self) -> None:
13691369
"""Test free busy report on a few items"""
13701370
calendar_path = "/calendar.ics/"
13711371
self.mkcalendar(calendar_path)
1372-
for i in (1,2):
1372+
for i in (1,2,10):
13731373
filename = "event{}.ics".format(i)
13741374
event = get_file_content(filename)
13751375
self.put(posixpath.join(calendar_path, filename), event)
@@ -1382,9 +1382,13 @@ def test_report_free_busy(self) -> None:
13821382
assert isinstance(response, vobject.base.Component)
13831383
assert len(responses) == 1
13841384
vcalendar = list(responses.values())[0]
1385-
assert len(vcalendar.vfreebusy_list) == 2
1385+
assert len(vcalendar.vfreebusy_list) == 3
1386+
types = {}
13861387
for vfb in vcalendar.vfreebusy_list:
1387-
assert vfb.fbtype.value == 'BUSY'
1388+
if vfb.fbtype.value not in types:
1389+
types[vfb.fbtype.value] = 0
1390+
types[vfb.fbtype.value] += 1
1391+
assert types == {'BUSY':2, 'FREE':1}
13881392

13891393
def _report_sync_token(
13901394
self, calendar_path: str, sync_token: Optional[str] = None

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# When the version is updated, a new section in the CHANGELOG.md file must be
2121
# added too.
22-
VERSION = "3.2.0.a1"
22+
VERSION = "3.2.0.a2"
2323

2424
with open("README.md", encoding="utf-8") as f:
2525
long_description = f.read()

0 commit comments

Comments
 (0)