[CalendarServer-changes] [1015]
CalendarServer/branches/users/cdaboo/availability-1005/twistedcaldav
/method/report_common.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jan 10 17:20:57 PST 2007
Revision: 1015
http://trac.macosforge.org/projects/calendarserver/changeset/1015
Author: cdaboo at apple.com
Date: 2007-01-10 17:20:56 -0800 (Wed, 10 Jan 2007)
Log Message:
-----------
Work in progress, but need to switch back to trunk.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/availability-1005/twistedcaldav/method/report_common.py
Modified: CalendarServer/branches/users/cdaboo/availability-1005/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/branches/users/cdaboo/availability-1005/twistedcaldav/method/report_common.py 2007-01-10 23:53:13 UTC (rev 1014)
+++ CalendarServer/branches/users/cdaboo/availability-1005/twistedcaldav/method/report_common.py 2007-01-11 01:20:56 UTC (rev 1015)
@@ -297,6 +297,10 @@
timerange,
name="VFREEBUSY",
),
+ caldavxml.ComponentFilter(
+ timerange,
+ name="VAVAILABILITY",
+ ),
name="VCALENDAR",
)
)
@@ -320,7 +324,6 @@
yield filteredaces
filteredaces = filteredaces.getResult()
- uri = request.urlForResource(calresource)
for name, uid, type in calresource.index().search(filter): #@UnusedVariable
# Ignore ones of this UID
@@ -352,6 +355,8 @@
processEventFreeBusy(calendar, fbinfo, timerange, tzinfo)
elif calendar.mainType() == "VFREEBUSY":
processFreeBusyFreeBusy(calendar, fbinfo, timerange)
+ elif calendar.mainType() == "VAVAILABILITY":
+ processAvailabilityFreeBusy(calendar, fbinfo, timerange)
else:
assert "Free-busy query returned unwanted component: %s in %r", (name, calresource,)
@@ -457,6 +462,41 @@
mapper = {"BUSY": 0, "BUSY-TENTATIVE": 1, "BUSY-UNAVAILABLE": 2}
fbinfo[mapper.get(fbtype, 0)].append(clipped)
+def processAvailabilityFreeBusy(calendar, fbinfo, timerange):
+ """
+ Extract free-busy data from a VAVAILABILITY component.
+ @param calendar: the L{Component} that is the VCALENDAR containing the VAVAILABILITY's.
+ @param fbinfo: the tuple used to store the three types of fb data.
+ @param timerange: the time range to restrict free busy data to.
+ """
+
+ tempfbinfo = ([], [], [])
+ for vav in [x for x in calendar.subcomponents() if x.name() == "VAVAILABILITY"]:
+
+ # Get overall start/end
+ start = vav.getStartDateUTC()
+ if start is None:
+ start = datetime.datetime(1900, 1, 1, 0, 0, 0, tzinfo=utc)
+ end = vav.getEndDateUTC()
+ if end is None:
+ end = datetime.datetime(3000, 1, 1, 0, 0, 0, tzinfo=utc)
+ period = (start, end)
+ overall = clipPeriod(period, (timerange.start, timerange.end))
+ if overall is None:
+ continue
+
+ # Now get periods for each instance of AVAILABLE sub-components
+ periods = processAvailablePeriods(vav, timerange)
+
+def processAvailablePeriods(calendar, timerange):
+ """
+ Extract instance period data from an AVAILABLE component.
+ @param calendar: the L{Component} that is the VAVAILABILITY containing the AVAILABLE's.
+ @param fbinfo: the tuple used to store the three types of fb data.
+ @param timerange: the time range to restrict free busy data to.
+ """
+ pass
+
def buildFreeBusyResult(fbinfo, timerange, organizer=None, attendee=None, uid=None):
"""
Generate a VCALENDAR object containing a single VFREEBUSY that is the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070110/6f7d8c87/attachment.html
More information about the calendarserver-changes
mailing list