Code Repositories xandikos / 5d5de82
Mostly fix freebusy. Jelmer Vernooń≥ 3 years ago
2 changed file(s) with 25 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
00 This document aims to document the compliance with various RFCs.
11
22 # rfc4918.txt (Core WebDAV) (obsoletes rfc2518)
3
4 Mostly supported.
35
46 ## HTTP Methods
57 - PROPFIND [supported, with 'propfind' but not 'allprop' or 'propname']
3032 - (15.5) getcontenttype [supported]
3133 - (15.6) getetag [supported]
3234 - (15.7) getlastmodified [not supported]
33 - (15.8) lockdiscovery [not supported]
35 - (15.8) lockdiscovery [supported]
3436 - (15.9) resourcetype [supported]
3537 - (15.10) supportedlock [supported]
3638 - (RFC2518 ONLY - 13.10) source [not supported]
111113
112114 # rfc4791.txt (CalDAV)
113115
116 Fully supported.
117
114118 ## DAV Properties
115119 - CALDAV:calendar-description [supported]
116120 - CALDAV:calendar-home-set [supported]
121125 - CALDAV:min-date-time [supported]
122126 - CALDAV:max-date-time [supported]
123127 - CALDAV:max-instances [not supported]
124 - CALDAV:max-atendees-per-instance [not supported]
128 - CALDAV:max-attendees-per-instance [not supported]
125129
126130 ## HTTP Methods
127131 - MKCALENDAR [not supported]
129133 - DAV Reports
130134 - CALDAV:calendar-query [supported]
131135 - CALDAV:calendar-multiget [supported]
132 - CALDAV:free-busy-query [not supported]
136 - CALDAV:free-busy-query [supported]
133137
134138 # rfc6352.txt (CardDAV)
139
140 Fully supported.
135141
136142 ## DAV Properties
137143 - CARDDAV:addressbook-description [supported]
3939 traverse_resource,
4040 )
4141
42
42 PROID = '-//Jelmer Vernooij//Xandikos//EN'
4343 WELLKNOWN_CALDAV_PATH = "/.well-known/caldav"
4444
4545 # https://tools.ietf.org/html/rfc4791, section 4.2
589589 raise AssertionError('unknown status %r' % status)
590590
591591
592 def extract_freebusy(comp):
592 def extract_freebusy(comp, tzify):
593593 kind = map_freebusy(comp)
594594 if kind == 'FREE':
595595 return None
596 ret = vPeriod()
596 # TODO(jelmer): Convert to Zulu?
597 if 'DTEND' in comp:
598 ret = vPeriod((tzify(comp['DTSTART'].dt), tzify(comp['DTEND'].dt)))
599 if 'DURATION' in comp:
600 ret = vPeriod((tzify(comp['DTSTART'].dt), comp['DURATION'].dt))
597601 if kind != 'BUSY':
598 ret['FBTYPE'] = kind
599 # TODO(jelmer): Convert to Zulu?
600 ret.start = comp['DTSTART']
601 if 'DTEND' in comp:
602 ret.end = comp['DTEND']
603 if 'DURATION' in comp:
604 ret.duration = comp['DURATION']
602 ret.params['FBTYPE'] = kind
605603 return ret
606604
607605
615613 for comp in c.subcomponents:
616614 if comp.name == 'VEVENT':
617615 if apply_time_range_vevent(start, end, comp, tzify):
618 vp = extract_freebusy(comp)
616 vp = extract_freebusy(comp, tzify)
619617 if vp is not None:
620618 yield vp
621619
636634 requested = el
637635 else:
638636 raise AssertionError("unexpected XML element")
637 # TODO(jelmer): Right timezone?
638 tzid = 'UTC'
639 tzify = lambda dt: as_tz_aware_ts(dt, pytz.timezone(tzid))
639640 (start, end) = _parse_time_range(requested)
640641 ret = ICalendar()
641642 ret['VERSION'] = '2.0'
642 ret['PRODID'] = '-//Jelmer Vernooij//Xandikos//EN'
643 ret['PRODID'] = PRODID
643644 fb = FreeBusy()
644 # TODO(jelmer): Set fb['DTSTAMP'] to utcnow
645 fb['DTSTAMP'] = vDDDTypes(datetime.datetime.now())
645646 fb['DTSTART'] = start
646647 fb['DTEND'] = end
647 fb['FREEBUSY'] = [iter_freebusy(
648 fb['FREEBUSY'] = list(iter_freebusy(
648649 traverse_resource(base_resource, base_href, depth),
649 start, end, tzify)]
650 start, end, tzify))
650651 ret.add_component(fb)
651652 # TODO(jelmer): Return as 200 OK
652653 print(ret.to_ical())