[CalendarServer-changes] [13648] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jun 17 12:13:36 PDT 2014
Revision: 13648
http://trac.calendarserver.org//changeset/13648
Author: cdaboo at apple.com
Date: 2014-06-17 12:13:35 -0700 (Tue, 17 Jun 2014)
Log Message:
-----------
Add additional auto-accept logging. Fix calverify timezone issue.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/calverify.py
CalendarServer/trunk/twistedcaldav/accounting.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py 2014-06-17 18:18:04 UTC (rev 13647)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py 2014-06-17 19:13:35 UTC (rev 13648)
@@ -66,6 +66,7 @@
InvalidICalendarDataError, Property, PERUSER_COMPONENT
)
from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
+from twistedcaldav.timezones import TimezoneCache
from txdav.caldav.datastore.scheduling.icalsplitter import iCalSplitter
from txdav.caldav.datastore.scheduling.implicit import ImplicitScheduler
from txdav.caldav.datastore.scheduling.itip import iTipGenerator
@@ -205,7 +206,7 @@
if not hasattr(Component, "maxAlarmCounts"):
Component.hasDuplicateAlarms = new_hasDuplicateAlarms
-VERSION = "11"
+VERSION = "12"
def printusage(e=None):
if e:
@@ -305,6 +306,8 @@
v11: Allows manual splitting of recurring events.
+v12: Fix double-booking false positives caused by timezones-by-reference.
+
""" % (VERSION,)
@@ -401,7 +404,9 @@
self.totalErrors = None
self.totalExceptions = None
+ TimezoneCache.create()
+
def title(self):
return ""
Modified: CalendarServer/trunk/twistedcaldav/accounting.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accounting.py 2014-06-17 18:18:04 UTC (rev 13647)
+++ CalendarServer/trunk/twistedcaldav/accounting.py 2014-06-17 19:13:35 UTC (rev 13648)
@@ -64,7 +64,7 @@
if "*" in enabledRecordGUIDs:
return True
- return record.guid in enabledRecordGUIDs
+ return record.uid in enabledRecordGUIDs
@@ -84,9 +84,9 @@
principalLogPath = record
elif accountingEnabled(category, record):
principalLogPath = os.path.join(
- record.guid[0:2],
- record.guid[2:4],
- record.guid
+ record.uid[0:2],
+ record.uid[2:4],
+ record.uid
)
else:
return None
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py 2014-06-17 18:18:04 UTC (rev 13647)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py 2014-06-17 19:13:35 UTC (rev 13648)
@@ -107,6 +107,7 @@
servertoserver=False,
event_details=None,
logItems=None,
+ accountingItems=None,
):
"""
Get freebusy information for a calendar. Different behavior for internal vs external calendars.
@@ -128,7 +129,8 @@
same_calendar_user,
servertoserver,
event_details,
- logItems
+ logItems,
+ accountingItems,
)
else:
return _internalGenerateFreeBusyInfo(
@@ -142,7 +144,8 @@
same_calendar_user,
servertoserver,
event_details,
- logItems
+ logItems,
+ accountingItems,
)
@@ -160,6 +163,7 @@
servertoserver=False,
event_details=None,
logItems=None,
+ accountingItems=None,
):
"""
Generate a freebusy response for an external (cross-pod) calendar by making a cross-pod call. This will bypass
@@ -187,6 +191,7 @@
servertoserver=False,
event_details=None,
logItems=None,
+ accountingItems=None,
):
"""
Run a free busy report on the specified calendar collection
@@ -207,6 +212,7 @@
remote lookup request.
@param event_details: a C{list} into which to store extended VEVENT details if not C{None}
@param logItems: a C{dict} to store logging info to
+ @param accountingItems: a C{dict} to store accounting info to
"""
# First check the privilege on this collection
@@ -262,6 +268,9 @@
if resources is None:
+ if accountingItems is not None:
+ accountingItems["fb-uncached"] = accountingItems.get("fb-uncached", 0) + 1
+
caching = False
if config.EnableFreeBusyCache:
# Log extended item
@@ -295,6 +304,9 @@
)
filter = Filter(filter)
tzinfo = filter.settimezone(tz)
+ if accountingItems is not None:
+ tr = cache_timerange if caching else timerange
+ accountingItems["fb-query-timerange"] = (str(tr.start), str(tr.end),)
try:
resources = yield calresource.search(filter, useruid=attendee_uid, fbtype=True)
@@ -304,6 +316,9 @@
raise InternalDataStoreError("Invalid indexedSearch query")
else:
+ if accountingItems is not None:
+ accountingItems["fb-cached"] = accountingItems.get("fb-cached", 0) + 1
+
# Log extended item
if logItems is not None:
logItems["fb-cached"] = logItems.get("fb-cached", 0) + 1
@@ -318,6 +333,29 @@
fbtype = 'F'
aggregated_resources.setdefault((name, uid, type, test_organizer,), []).append((float, start, end, fbtype,))
+ if accountingItems is not None:
+ accountingItems["fb-resources"] = {}
+ for k, v in aggregated_resources.items():
+ name, uid, type, test_organizer = k
+ accountingItems["fb-resources"][uid] = []
+ for float, start, end, fbtype in v:
+ fbstart = parseSQLTimestampToPyCalendar(start)
+ if float == 'Y':
+ fbstart.setTimezone(tzinfo)
+ else:
+ fbstart.setTimezone(Timezone(utc=True))
+ fbend = parseSQLTimestampToPyCalendar(end)
+ if float == 'Y':
+ fbend.setTimezone(tzinfo)
+ else:
+ fbend.setTimezone(Timezone(utc=True))
+ accountingItems["fb-resources"][uid].append((
+ float,
+ str(fbstart),
+ str(fbend),
+ fbtype,
+ ))
+
for key in aggregated_resources.iterkeys():
name, uid, type, test_organizer = key
@@ -407,7 +445,13 @@
elif (test_organizer is None) and same_calendar_user:
continue
+ if accountingItems is not None:
+ accountingItems.setdefault("fb-filter-match", []).append(uid)
+
if filter.match(calendar, None):
+ if accountingItems is not None:
+ accountingItems.setdefault("fb-filter-matched", []).append(uid)
+
# Check size of results is within limit
matchtotal += 1
if matchtotal > config.MaxQueryWithDataResults:
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2014-06-17 18:18:04 UTC (rev 13647)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2014-06-17 19:13:35 UTC (rev 13648)
@@ -649,7 +649,7 @@
if accountingEnabled("AutoScheduling", self.recipient.record):
accounting = {
"when": DateTime.getNowUTC().getText(),
- "automode": automode,
+ "automode": automode.name,
"changed": False,
}
else:
@@ -754,7 +754,7 @@
end=str(makeTimedUTC(instance.end)),
)
- yield generateFreeBusyInfo(testcal, fbinfo, tr, 0, uid, servertoserver=True)
+ yield generateFreeBusyInfo(testcal, fbinfo, tr, 0, uid, servertoserver=True, accountingItems=accounting if len(instances) == 1 else None)
# If any fbinfo entries exist we have an overlap
if len(fbinfo[0]) or len(fbinfo[1]) or len(fbinfo[2]):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140617/99023cdb/attachment.html>
More information about the calendarserver-changes
mailing list