<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13644] CalendarServer/branches/release/CalendarServer-5.3-dev</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/13644">13644</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-06-17 11:07:46 -0700 (Tue, 17 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add additional auto-accept logging. Fix calverify timezone issue.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devcalendarservertoolscalverifypy">CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingfreebusypy">CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingprocessingpy">CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer53devcalendarservertoolscalverifypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/calendarserver/tools/calverify.py (13643 => 13644)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx">     InvalidICalendarDataError, Property, PERUSER_COMPONENT
</span><span class="cx"> from txdav.caldav.datastore.scheduling.itip import iTipGenerator
</span><span class="cx"> from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
</span><ins>+from twistedcaldav.timezones import TimezoneCache
</ins><span class="cx"> from twistedcaldav.util import normalizationLookup
</span><span class="cx"> 
</span><span class="cx"> from txdav.caldav.icalendarstore import ComponentUpdateState
</span><span class="lines">@@ -208,7 +209,7 @@
</span><span class="cx"> if not hasattr(Component, &quot;maxAlarmCounts&quot;):
</span><span class="cx">     Component.hasDuplicateAlarms = new_hasDuplicateAlarms
</span><span class="cx"> 
</span><del>-VERSION = &quot;11&quot;
</del><ins>+VERSION = &quot;12&quot;
</ins><span class="cx"> 
</span><span class="cx"> def printusage(e=None):
</span><span class="cx">     if e:
</span><span class="lines">@@ -309,6 +310,8 @@
</span><span class="cx"> 
</span><span class="cx"> v11: Allows manual splitting of recurring events.
</span><span class="cx"> 
</span><ins>+v12: Fix double-booking false positives caused by timezones-by-reference.
+
</ins><span class="cx"> &quot;&quot;&quot; % (VERSION,)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -406,7 +409,9 @@
</span><span class="cx">         self.totalErrors = None
</span><span class="cx">         self.totalExceptions = None
</span><span class="cx"> 
</span><ins>+        TimezoneCache.create()
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def title(self):
</span><span class="cx">         return &quot;&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingfreebusypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/freebusy.py (13643 => 13644)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -105,6 +105,7 @@
</span><span class="cx">     servertoserver=False,
</span><span class="cx">     event_details=None,
</span><span class="cx">     logItems=None,
</span><ins>+    accountingItems=None,
</ins><span class="cx"> ):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Run a free busy report on the specified calendar collection
</span><span class="lines">@@ -125,6 +126,7 @@
</span><span class="cx">         remote lookup request.
</span><span class="cx">     @param event_details: a C{list} into which to store extended VEVENT details if not C{None}
</span><span class="cx">     @param logItems: a C{dict} to store logging info to
</span><ins>+    @param accountingItems: a C{dict} to store accounting info to
</ins><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">     # First check the privilege on this collection
</span><span class="lines">@@ -180,6 +182,9 @@
</span><span class="cx"> 
</span><span class="cx">     if resources is None:
</span><span class="cx"> 
</span><ins>+        if accountingItems is not None:
+            accountingItems[&quot;fb-uncached&quot;] = accountingItems.get(&quot;fb-uncached&quot;, 0) + 1
+
</ins><span class="cx">         caching = False
</span><span class="cx">         if config.EnableFreeBusyCache:
</span><span class="cx">             # Log extended item
</span><span class="lines">@@ -203,16 +208,19 @@
</span><span class="cx"> 
</span><span class="cx">         # Create fake filter element to match time-range
</span><span class="cx">         filter = caldavxml.Filter(
</span><del>-                      caldavxml.ComponentFilter(
-                          caldavxml.ComponentFilter(
-                              cache_timerange if caching else timerange,
-                              name=(&quot;VEVENT&quot;, &quot;VFREEBUSY&quot;, &quot;VAVAILABILITY&quot;),
-                          ),
-                          name=&quot;VCALENDAR&quot;,
-                       )
-                  )
</del><ins>+            caldavxml.ComponentFilter(
+                caldavxml.ComponentFilter(
+                    cache_timerange if caching else timerange,
+                    name=(&quot;VEVENT&quot;, &quot;VFREEBUSY&quot;, &quot;VAVAILABILITY&quot;),
+                ),
+                name=&quot;VCALENDAR&quot;,
+            )
+        )
</ins><span class="cx">         filter = calendarqueryfilter.Filter(filter)
</span><span class="cx">         tzinfo = filter.settimezone(tz)
</span><ins>+        if accountingItems is not None:
+            tr = cache_timerange if caching else timerange
+            accountingItems[&quot;fb-query-timerange&quot;] = (str(tr.start), str(tr.end),)
</ins><span class="cx"> 
</span><span class="cx">         try:
</span><span class="cx">             resources = yield calresource._index.indexedSearch(filter, useruid=attendee_uid, fbtype=True)
</span><span class="lines">@@ -220,8 +228,13 @@
</span><span class="cx">                 yield FBCacheEntry.makeCacheEntry(calresource, attendee_uid, cache_timerange, resources)
</span><span class="cx">         except IndexedSearchException:
</span><span class="cx">             resources = yield calresource._index.bruteForceSearch()
</span><ins>+            if accountingItems is not None:
+                accountingItems[&quot;fb-bruteforce&quot;] = True
</ins><span class="cx"> 
</span><span class="cx">     else:
</span><ins>+        if accountingItems is not None:
+            accountingItems[&quot;fb-cached&quot;] = accountingItems.get(&quot;fb-cached&quot;, 0) + 1
+
</ins><span class="cx">         # Log extended item
</span><span class="cx">         if logItems is not None:
</span><span class="cx">             logItems[&quot;fb-cached&quot;] = logItems.get(&quot;fb-cached&quot;, 0) + 1
</span><span class="lines">@@ -236,6 +249,29 @@
</span><span class="cx">             fbtype = 'F'
</span><span class="cx">         aggregated_resources.setdefault((name, uid, type, test_organizer,), []).append((float, start, end, fbtype,))
</span><span class="cx"> 
</span><ins>+    if accountingItems is not None:
+        accountingItems[&quot;fb-resources&quot;] = {}
+        for k, v in aggregated_resources.items():
+            name, uid, type, test_organizer = k
+            accountingItems[&quot;fb-resources&quot;][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[&quot;fb-resources&quot;][uid].append((
+                    float,
+                    str(fbstart),
+                    str(fbend),
+                    fbtype,
+                ))
+
</ins><span class="cx">     for key in aggregated_resources.iterkeys():
</span><span class="cx"> 
</span><span class="cx">         name, uid, type, test_organizer = key
</span><span class="lines">@@ -325,7 +361,13 @@
</span><span class="cx">                     elif (test_organizer is None) and same_calendar_user:
</span><span class="cx">                         continue
</span><span class="cx"> 
</span><ins>+            if accountingItems is not None:
+                accountingItems.setdefault(&quot;fb-filter-match&quot;, []).append(uid)
+
</ins><span class="cx">             if filter.match(calendar, None):
</span><ins>+                if accountingItems is not None:
+                    accountingItems.setdefault(&quot;fb-filter-matched&quot;, []).append(uid)
+
</ins><span class="cx">                 # Check size of results is within limit
</span><span class="cx">                 matchtotal += 1
</span><span class="cx">                 if matchtotal &gt; config.MaxQueryWithDataResults:
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingprocessingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py (13643 => 13644)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -904,7 +904,7 @@
</span><span class="cx">                             end=str(makeTimedUTC(instance.end)),
</span><span class="cx">                         )
</span><span class="cx"> 
</span><del>-                        yield generateFreeBusyInfo(testcal, fbinfo, tr, 0, uid, servertoserver=True)
</del><ins>+                        yield generateFreeBusyInfo(testcal, fbinfo, tr, 0, uid, servertoserver=True, accountingItems=accounting if len(instances) == 1 else None)
</ins><span class="cx"> 
</span><span class="cx">                         # If any fbinfo entries exist we have an overlap
</span><span class="cx">                         if len(fbinfo[0]) or len(fbinfo[1]) or len(fbinfo[2]):
</span></span></pre>
</div>
</div>

</body>
</html>