<!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>[4494] CalendarServer/branches/more-deferreds-3</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.macosforge.org/projects/calendarserver/changeset/4494">4494</a></dd>
<dt>Author</dt> <dd>william_short@apple.com</dd>
<dt>Date</dt> <dd>2009-08-13 12:22:57 -0700 (Thu, 13 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>closer. 35 failures</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesmoredeferreds3bincaldavd">CalendarServer/branches/more-deferreds-3/bin/caldavd</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavdirectorycalendarpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/calendar.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavmethodgetpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/method/get.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavmethodput_commonpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/method/put_common.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavmethodreport_commonpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/method/report_common.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavresourcepy">CalendarServer/branches/more-deferreds-3/twistedcaldav/resource.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavschedulingimplicitpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/implicit.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavschedulingprocessingpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/processing.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavschedulingschedulerpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/scheduler.py</a></li>
<li><a href="#CalendarServerbranchesmoredeferreds3twistedcaldavstaticpy">CalendarServer/branches/more-deferreds-3/twistedcaldav/static.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesmoredeferreds3bincaldavd"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/bin/caldavd (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/bin/caldavd        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/bin/caldavd        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -120,4 +120,4 @@
</span><span class="cx"> 
</span><span class="cx"> echo exec &quot;${python}&quot; &quot;${twistdpath}&quot; &quot;${twistd_reactor}&quot; ${daemonize} ${username} ${groupname} &quot;${plugin_name}&quot; ${configfile} ${service_type} ${profile} &quot;${child_reactor}&quot;;
</span><span class="cx"> 
</span><del>-exec &quot;${python}&quot; &quot;${twistdpath}&quot; ${twistd_reactor}  ${daemonize} ${username} ${groupname} &quot;${plugin_name}&quot; ${configfile} ${service_type} ${profile} ${child_reactor};
</del><ins>+exec &quot;${python}&quot; &quot;${twistdpath}&quot; ${twistd_reactor} ${daemonize} ${username} ${groupname} &quot;${plugin_name}&quot; ${configfile} ${service_type} ${profile} ${child_reactor};
</ins></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavdirectorycalendarpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/calendar.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/calendar.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/calendar.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -251,7 +251,35 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Calendar home collection resource.
</span><span class="cx">     &quot;&quot;&quot;
</span><ins>+    @classmethod
+    def fetch(cls, *a, **kw):
+        d = super(DirectoryCalendarHomeResource, cls).fetch(*a, **kw)
+        def _populateChildren(self):
+            # Cache children which must be of a specific type
+            childlist = (
+                (&quot;inbox&quot; , ScheduleInboxResource ),
+                (&quot;outbox&quot;, ScheduleOutboxResource),
+            )
+            if config.EnableDropBox:
+                childlist += (
+                    (&quot;dropbox&quot;, DropBoxHomeResource),
+                )
+            if config.FreeBusyURL.Enabled:
+                childlist += (
+                    (&quot;freebusy&quot;, FreeBusyURLResource),
+                )
+            ds = []
+            for name, cls in childlist:
+                d = self.provisionChild(name)
+                def _newChild(child):
+                    assert isinstance(child, cls), &quot;Child %r is not a %s: %r&quot; % (name, cls.__name__, child)
+                    self.putChild(name, child)
+                d.addCallback(_newChild)
+                ds.append(d)
+            return gatherResults(ds).addCallback(lambda _: self)
</ins><span class="cx"> 
</span><ins>+        return d.addCallback(_populateChildren)
+
</ins><span class="cx">     def __init__(self, parent, record):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         @param path: the path to the file which will back the resource.
</span><span class="lines">@@ -264,6 +292,7 @@
</span><span class="cx">         self.record = record
</span><span class="cx">         self.parent = parent
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def provisionDefaultCalendars(self):
</span><span class="cx"> 
</span><span class="cx">         # Disable notifications during provisioning
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavmethodgetpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/method/get.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/method/get.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/method/get.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-##
</del><ins>+\##
</ins><span class="cx"> # Copyright (c) 2005-2008 Apple Inc. All rights reserved.
</span><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
</span><span class="lines">@@ -53,8 +53,8 @@
</span><span class="cx">             if not isowner:
</span><span class="cx">                 # Now &quot;filter&quot; the resource calendar data through the CALDAV:calendar-data element and apply
</span><span class="cx">                 # access restrictions to the data.
</span><del>-                caldata = caldavxml.CalendarData().elementFromResourceWithAccessRestrictions(self, access).calendarData()
-
</del><ins>+                el = yield caldavxml.CalendarData().elementFromResourceWithAccessRestrictions(self, access)
+                caldata = el.calendarData()
</ins><span class="cx">                 response = Response()
</span><span class="cx">                 response.stream = MemoryStream(caldata)
</span><span class="cx">                 response.headers.setHeader(&quot;content-type&quot;, MimeType.fromString(&quot;text/calendar; charset=utf-8&quot;))
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavmethodput_commonpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/method/put_common.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/method/put_common.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/method/put_common.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -703,9 +703,10 @@
</span><span class="cx">             if old_has_private_comments and not new_has_private_comments:
</span><span class="cx">                 # Transfer old comments to new calendar
</span><span class="cx">                 log.debug(&quot;Private Comments properties were entirely removed by the client. Restoring existing properties.&quot;)
</span><del>-                self.destination.iCalendar().addCallback(self.calendar.transferProperties,
-                                                         &quot;X-CALENDARSERVER-PRIVATE-COMMENT&quot;,
-                                                         &quot;X-CALENDARSERVER-ATTENDEE-COMMENT&quot;)
</del><ins>+                self.destination.iCalendar().addCallback(
+                    lambda _: self.calendar.transferProperties(
+                        &quot;X-CALENDARSERVER-PRIVATE-COMMENT&quot;,
+                        &quot;X-CALENDARSERVER-ATTENDEE-COMMENT&quot;))
</ins><span class="cx">                 self.calendardata = None
</span><span class="cx">         
</span><span class="cx">         return new_has_private_comments
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavmethodreport_commonpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/method/report_common.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/method/report_common.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/method/report_common.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -417,7 +417,7 @@
</span><span class="cx">                     fbinfo[fbtype_index_mapper.get(fbtype, 0)].append(clipped)
</span><span class="cx">                 
</span><span class="cx">         else:
</span><del>-            calendar = yield ncalresource.iCalendar(name)
</del><ins>+            calendar = yield calresource.iCalendar(name)
</ins><span class="cx">             
</span><span class="cx">             # The calendar may come back as None if the resource is being changed, or was deleted
</span><span class="cx">             # between our initial index query and getting here. For now we will ignore this error, but in
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavresourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/resource.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/resource.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/resource.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -488,10 +488,10 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         assert depth in (&quot;0&quot;, &quot;1&quot;, &quot;infinity&quot;), &quot;Invalid depth: %s&quot; % (depth,)
</span><span class="cx"> 
</span><del>-        def checkPrivilegesError(failure):
</del><ins>+        def checkPrivilegesError(failure, children):
</ins><span class="cx">             failure.trap(AccessDeniedError)
</span><span class="cx"> 
</span><del>-            reactor.callLater(0, getChild)
</del><ins>+            reactor.callLater(0, getChild, children)
</ins><span class="cx"> 
</span><span class="cx">         def checkPrivileges(child):
</span><span class="cx">             if privileges is None:
</span><span class="lines">@@ -521,7 +521,7 @@
</span><span class="cx">                 childpath = joinURL(basepath, childname)
</span><span class="cx">                 child = request.locateResource(childpath)
</span><span class="cx">                 child.addCallback(checkPrivileges)
</span><del>-                child.addCallbacks(gotChild, checkPrivilegesError, (childpath, children))
</del><ins>+                child.addCallbacks(gotChild, checkPrivilegesError, (childpath, children), None, (children,))
</ins><span class="cx">                 child.addErrback(completionDeferred.errback)
</span><span class="cx"> 
</span><span class="cx">         completionDeferred = Deferred()
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavschedulingimplicitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/implicit.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/implicit.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/implicit.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -767,7 +767,7 @@
</span><span class="cx">         else:
</span><span class="cx">             # Make sure ORGANIZER is not changed
</span><span class="cx">             if self.resource.exists():
</span><del>-                self.oldcalendar = self.resource.iCalendar()
</del><ins>+                self.oldcalendar = yield self.resource.iCalendar()
</ins><span class="cx">                 oldOrganizer = self.oldcalendar.getOrganizer()
</span><span class="cx">                 newOrganizer = self.calendar.getOrganizer()
</span><span class="cx">                 if oldOrganizer != newOrganizer:
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavschedulingprocessingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/processing.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/processing.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/processing.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">         self.recipient_calendar_name = None
</span><span class="cx">         calendar_resource, resource_name, calendar_collection, calendar_collection_uri = (yield getCalendarObjectForPrincipals(self.request, self.recipient.principal, self.uid))
</span><span class="cx">         if calendar_resource:
</span><del>-            self.recipient_calendar = calendar_resource.iCalendar()
</del><ins>+            self.recipient_calendar = yield calendar_resource.iCalendar()
</ins><span class="cx">             self.recipient_calendar_collection = calendar_collection
</span><span class="cx">             self.recipient_calendar_collection_uri = calendar_collection_uri
</span><span class="cx">             self.recipient_calendar_name = resource_name
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavschedulingschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/scheduler.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/scheduler.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/scheduling/scheduler.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -564,7 +564,7 @@
</span><span class="cx">     
</span><span class="cx">         # Attendee's Outbox MUST be the request URI
</span><span class="cx">         attendeePrincipal = self.resource.principalForCalendarUserAddress(attendee)
</span><del>-        d = attendeePrincipal.scheduleOutboxURL(self.request)
</del><ins>+        d = attendeePrincipal.scheduleOutboxURL()
</ins><span class="cx">         def _gotOutboxURL(outboxURL):
</span><span class="cx">             if attendeePrincipal:
</span><span class="cx">                 if self.doingPOST and outboxURL != self.request.uri:
</span></span></pre></div>
<a id="CalendarServerbranchesmoredeferreds3twistedcaldavstaticpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/static.py (4493 => 4494)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/more-deferreds-3/twistedcaldav/static.py        2009-08-13 19:22:56 UTC (rev 4493)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/static.py        2009-08-13 19:22:57 UTC (rev 4494)
</span><span class="lines">@@ -316,8 +316,8 @@
</span><span class="cx">             if not isowner:
</span><span class="cx">                 # Now &quot;filter&quot; the resource calendar data through the CALDAV:calendar-data element and apply
</span><span class="cx">                 # access restrictions to the data.
</span><del>-                return caldavxml.CalendarData().elementFromResourceWithAccessRestrictions(self, access).calendarData()
-
</del><ins>+                d = caldavxml.CalendarData().elementFromResourceWithAccessRestrictions(self, access)
+                return d.addCallback(lambda el: el.calendarData())
</ins><span class="cx">         return self.iCalendarText()
</span><span class="cx"> 
</span><span class="cx">     def iCalendarText(self, name=None):
</span></span></pre>
</div>
</div>

</body>
</html>