[CalendarServer-changes] [13644] CalendarServer/branches/release/CalendarServer-5.3-dev

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 17 11:07:46 PDT 2014


Revision: 13644
          http://trac.calendarserver.org//changeset/13644
Author:   cdaboo at apple.com
Date:     2014-06-17 11:07:46 -0700 (Tue, 17 Jun 2014)
Log Message:
-----------
Add additional auto-accept logging. Fix calverify timezone issue.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py	2014-06-17 10:08:02 UTC (rev 13643)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py	2014-06-17 18:07:46 UTC (rev 13644)
@@ -68,6 +68,7 @@
     InvalidICalendarDataError, Property, PERUSER_COMPONENT
 from txdav.caldav.datastore.scheduling.itip import iTipGenerator
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
+from twistedcaldav.timezones import TimezoneCache
 from twistedcaldav.util import normalizationLookup
 
 from txdav.caldav.icalendarstore import ComponentUpdateState
@@ -208,7 +209,7 @@
 if not hasattr(Component, "maxAlarmCounts"):
     Component.hasDuplicateAlarms = new_hasDuplicateAlarms
 
-VERSION = "11"
+VERSION = "12"
 
 def printusage(e=None):
     if e:
@@ -309,6 +310,8 @@
 
 v11: Allows manual splitting of recurring events.
 
+v12: Fix double-booking false positives caused by timezones-by-reference.
+
 """ % (VERSION,)
 
 
@@ -406,7 +409,9 @@
         self.totalErrors = None
         self.totalExceptions = None
 
+        TimezoneCache.create()
 
+
     def title(self):
         return ""
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py	2014-06-17 10:08:02 UTC (rev 13643)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py	2014-06-17 18:07:46 UTC (rev 13644)
@@ -105,6 +105,7 @@
     servertoserver=False,
     event_details=None,
     logItems=None,
+    accountingItems=None,
 ):
     """
     Run a free busy report on the specified calendar collection
@@ -125,6 +126,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
@@ -180,6 +182,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
@@ -203,16 +208,19 @@
 
         # Create fake filter element to match time-range
         filter = caldavxml.Filter(
-                      caldavxml.ComponentFilter(
-                          caldavxml.ComponentFilter(
-                              cache_timerange if caching else timerange,
-                              name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
-                          ),
-                          name="VCALENDAR",
-                       )
-                  )
+            caldavxml.ComponentFilter(
+                caldavxml.ComponentFilter(
+                    cache_timerange if caching else timerange,
+                    name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
+                ),
+                name="VCALENDAR",
+            )
+        )
         filter = calendarqueryfilter.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._index.indexedSearch(filter, useruid=attendee_uid, fbtype=True)
@@ -220,8 +228,13 @@
                 yield FBCacheEntry.makeCacheEntry(calresource, attendee_uid, cache_timerange, resources)
         except IndexedSearchException:
             resources = yield calresource._index.bruteForceSearch()
+            if accountingItems is not None:
+                accountingItems["fb-bruteforce"] = True
 
     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
@@ -236,6 +249,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(PyCalendarTimezone(utc=True))
+                fbend = parseSQLTimestampToPyCalendar(end)
+                if float == 'Y':
+                    fbend.setTimezone(tzinfo)
+                else:
+                    fbend.setTimezone(PyCalendarTimezone(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
@@ -325,7 +361,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/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py	2014-06-17 10:08:02 UTC (rev 13643)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py	2014-06-17 18:07:46 UTC (rev 13644)
@@ -904,7 +904,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/baa9b06d/attachment.html>


More information about the calendarserver-changes mailing list