<!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>[12935] CalendarServer/branches/users/sagen/move2who-4</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/12935">12935</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-03-18 10:55:31 -0700 (Tue, 18 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix more tests</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarserveraccesslogpy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/accesslog.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarserverprovisionrootpy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/root.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarserverprovisiontesttest_rootpy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/test/test_root.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolscalverifypy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsexportpy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/export.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsshelldirectorypy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/directory.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsshellvfspy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/vfs.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavcachepy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/cache.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorycalendarpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/calendar.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytestutilpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavextensionspy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/extensions.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavtestutilpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagenmove2who4calendarserveraccesslogpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/accesslog.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/accesslog.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/accesslog.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -155,8 +155,9 @@
</span><span class="cx">                 format += ' i=%(serverInstance)s'
</span><span class="cx">                 formatArgs[&quot;serverInstance&quot;] = config.LogID if config.LogID else &quot;0&quot;
</span><span class="cx"> 
</span><del>-                format += ' or=%(outstandingRequests)s'
-                formatArgs[&quot;outstandingRequests&quot;] = request.chanRequest.channel.factory.outstandingRequests
</del><ins>+                if request.chanRequest:  # This can be None during tests
+                    format += ' or=%(outstandingRequests)s'
+                    formatArgs[&quot;outstandingRequests&quot;] = request.chanRequest.channel.factory.outstandingRequests
</ins><span class="cx"> 
</span><span class="cx">                 # Tags for time stamps collected along the way - the first one in the list is the initial
</span><span class="cx">                 # time for request creation - we use that to track the entire request/response time
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarserverprovisionrootpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/root.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/root.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/root.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx">         request.checkingSACL = True
</span><span class="cx"> 
</span><span class="cx">         for collection in self.principalCollections():
</span><del>-            principal = collection._principalForURI(authzUser.children[0].children[0].data)
</del><ins>+            principal = yield collection._principalForURI(authzUser.children[0].children[0].data)
</ins><span class="cx">             if principal is None:
</span><span class="cx">                 response = (yield UnauthorizedResponse.makeResponse(
</span><span class="cx">                     request.credentialFactories,
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarserverprovisiontesttest_rootpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/test/test_root.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/test/test_root.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/provision/test/test_root.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -14,29 +14,22 @@
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><span class="cx"> 
</span><del>-import os
</del><span class="cx"> 
</span><del>-from twisted.cred.portal import Portal
</del><span class="cx"> from twisted.internet.defer import inlineCallbacks, maybeDeferred, returnValue
</span><span class="cx"> 
</span><ins>+from twext.who.idirectory import RecordType
</ins><span class="cx"> from txweb2 import http_headers
</span><span class="cx"> from txweb2 import responsecode
</span><del>-from txweb2 import server
-from txweb2.auth import basic
-from txweb2.dav import auth
</del><span class="cx"> from txdav.xml import element as davxml
</span><span class="cx"> from txweb2.http import HTTPError
</span><span class="cx"> from txweb2.iweb import IResponse
</span><del>-from txweb2.test.test_server import SimpleRequest
</del><span class="cx"> 
</span><del>-from twistedcaldav.test.util import TestCase
</del><ins>+from twistedcaldav.test.util import StoreTestCase, SimpleStoreRequest
</ins><span class="cx"> from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
</span><del>-from twistedcaldav.directory.xmlfile import XMLDirectoryService
-from twistedcaldav.directory.test.test_xmlfile import xmlFile, augmentsFile
</del><span class="cx"> 
</span><span class="cx"> from calendarserver.provision.root import RootResource
</span><del>-from twistedcaldav.directory import augment
</del><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class FakeCheckSACL(object):
</span><span class="cx">     def __init__(self, sacls=None):
</span><span class="cx">         self.sacls = sacls or {}
</span><span class="lines">@@ -53,48 +46,16 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-class RootTests(TestCase):
</del><ins>+class RootTests(StoreTestCase):
</ins><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def setUp(self):
</span><del>-        super(RootTests, self).setUp()
</del><ins>+        yield super(RootTests, self).setUp()
</ins><span class="cx"> 
</span><del>-        self.docroot = self.mktemp()
-        os.mkdir(self.docroot)
-
</del><span class="cx">         RootResource.CheckSACL = FakeCheckSACL(sacls={&quot;calendar&quot;: [&quot;dreid&quot;]})
</span><span class="cx"> 
</span><del>-        directory = XMLDirectoryService(
-            {
-                &quot;xmlFile&quot; : xmlFile,
-                &quot;augmentService&quot; :
-                    augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
-            }
-        )
</del><span class="cx"> 
</span><del>-        principals = DirectoryPrincipalProvisioningResource(
-            &quot;/principals/&quot;,
-            directory
-        )
</del><span class="cx"> 
</span><del>-        root = RootResource(self.docroot, principalCollections=[principals])
-
-        root.putChild(&quot;principals&quot;,
-                      principals)
-
-        portal = Portal(auth.DavRealm())
-        portal.registerChecker(directory)
-
-        self.root = auth.AuthenticationWrapper(
-            root,
-            portal,
-            (basic.BasicCredentialFactory(&quot;Test realm&quot;),),
-            (basic.BasicCredentialFactory(&quot;Test realm&quot;),),
-            loginInterfaces=(auth.IPrincipal,))
-
-        self.site = server.Site(self.root)
-
-
-
</del><span class="cx"> class ComplianceTests(RootTests):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Tests to verify CalDAV compliance of the root resource.
</span><span class="lines">@@ -107,8 +68,8 @@
</span><span class="cx">         Deferred which will fire with (something adaptable to) an HTTP response
</span><span class="cx">         object.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        request = SimpleRequest(self.site, method, (&quot;/&quot;.join([&quot;&quot;] + segments)))
-        rsrc = self.root
</del><ins>+        request = SimpleStoreRequest(self, method, (&quot;/&quot;.join([&quot;&quot;] + segments)))
+        rsrc = self.actualRoot
</ins><span class="cx">         while segments:
</span><span class="cx">             rsrc, segments = (yield maybeDeferred(
</span><span class="cx">                 rsrc.locateChild, request, segments
</span><span class="lines">@@ -138,18 +99,12 @@
</span><span class="cx"> 
</span><span class="cx">         should return a valid resource
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        self.root.resource.useSacls = False
</del><ins>+        self.actualRoot.useSacls = False
</ins><span class="cx"> 
</span><del>-        request = SimpleRequest(self.site,
-                                &quot;GET&quot;,
-                                &quot;/principals/&quot;)
</del><ins>+        request = SimpleStoreRequest(self, &quot;GET&quot;, &quot;/principals/&quot;)
</ins><span class="cx"> 
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            self.root.locateChild, request, [&quot;principals&quot;]
-        ))
-
</del><span class="cx">         resrc, segments = (yield maybeDeferred(
</span><del>-            resrc.locateChild, request, [&quot;principals&quot;]
</del><ins>+            self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">         ))
</span><span class="cx"> 
</span><span class="cx">         self.failUnless(
</span><span class="lines">@@ -169,26 +124,21 @@
</span><span class="cx"> 
</span><span class="cx">         should return a valid resource
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        self.root.resource.useSacls = True
</del><ins>+        self.actualRoot.useSacls = True
</ins><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        record = yield self.directory.recordWithShortName(
+            RecordType.user,
+            u&quot;dreid&quot;
+        )
+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;GET&quot;,
</span><span class="cx">             &quot;/principals/&quot;,
</span><del>-            headers=http_headers.Headers({
-                &quot;Authorization&quot;: [
-                    &quot;basic&quot;,
-                    &quot;%s&quot; % (&quot;dreid:dierd&quot;.encode(&quot;base64&quot;),)
-                ]
-            })
</del><ins>+            authRecord=record
</ins><span class="cx">         )
</span><span class="cx"> 
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            self.root.locateChild, request, [&quot;principals&quot;]
-        ))
-
</del><span class="cx">         resrc, segments = (yield maybeDeferred(
</span><del>-            resrc.locateChild, request, [&quot;principals&quot;]
</del><ins>+            self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">         ))
</span><span class="cx"> 
</span><span class="cx">         self.failUnless(
</span><span class="lines">@@ -218,28 +168,27 @@
</span><span class="cx"> 
</span><span class="cx">         should return a 403 forbidden response
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        self.root.resource.useSacls = True
</del><ins>+        self.actualRoot.useSacls = True
</ins><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        record = yield self.directory.recordWithShortName(
+            RecordType.user,
+            u&quot;wsanchez&quot;
+        )
+
+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;GET&quot;,
</span><span class="cx">             &quot;/principals/&quot;,
</span><del>-            headers=http_headers.Headers({
-                &quot;Authorization&quot;: [
-                    &quot;basic&quot;,
-                    &quot;%s&quot; % (&quot;wsanchez:zehcnasw&quot;.encode(&quot;base64&quot;),)
-                ]
-            })
</del><ins>+            authRecord=record
</ins><span class="cx">         )
</span><span class="cx"> 
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            self.root.locateChild, request, [&quot;principals&quot;]
-        ))
-
</del><span class="cx">         try:
</span><span class="cx">             resrc, _ignore_segments = (yield maybeDeferred(
</span><del>-                resrc.locateChild, request, [&quot;principals&quot;]
</del><ins>+                self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">             ))
</span><ins>+            raise AssertionError(
+                &quot;RootResource.locateChild did not return an error&quot;
+            )
</ins><span class="cx">         except HTTPError, e:
</span><span class="cx">             self.assertEquals(e.response.code, 403)
</span><span class="cx"> 
</span><span class="lines">@@ -253,20 +202,16 @@
</span><span class="cx">         should return a 401 UnauthorizedResponse
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        self.root.resource.useSacls = True
-        request = SimpleRequest(
-            self.site,
</del><ins>+        self.actualRoot.useSacls = True
+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;GET&quot;,
</span><span class="cx">             &quot;/principals/&quot;
</span><span class="cx">         )
</span><span class="cx"> 
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            self.root.locateChild, request, [&quot;principals&quot;]
-        ))
-
</del><span class="cx">         try:
</span><span class="cx">             resrc, _ignore_segments = (yield maybeDeferred(
</span><del>-                resrc.locateChild, request, [&quot;principals&quot;]
</del><ins>+                self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">             ))
</span><span class="cx">             raise AssertionError(
</span><span class="cx">                 &quot;RootResource.locateChild did not return an error&quot;
</span><span class="lines">@@ -283,24 +228,28 @@
</span><span class="cx"> 
</span><span class="cx">         should return a 401 UnauthorizedResponse
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        self.root.resource.useSacls = True
</del><ins>+        self.actualRoot.useSacls = True
</ins><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;GET&quot;,
</span><span class="cx">             &quot;/principals/&quot;,
</span><del>-            headers=http_headers.Headers({
-                    &quot;Authorization&quot;: [&quot;basic&quot;, &quot;%s&quot; % (
-                            &quot;dreid:dreid&quot;.encode(&quot;base64&quot;),)]}))
</del><ins>+            headers=http_headers.Headers(
+                {
+                    &quot;Authorization&quot;: [
+                        &quot;basic&quot;, &quot;%s&quot; % (&quot;dreid:dreid&quot;.encode(&quot;base64&quot;),)
+                    ]
+                }
+            )
+        )
</ins><span class="cx"> 
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            self.root.locateChild, request, [&quot;principals&quot;]
-        ))
-
</del><span class="cx">         try:
</span><span class="cx">             resrc, _ignore_segments = (yield maybeDeferred(
</span><del>-                resrc.locateChild, request, [&quot;principals&quot;]
</del><ins>+                self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">             ))
</span><ins>+            raise AssertionError(
+                &quot;RootResource.locateChild did not return an error&quot;
+            )
</ins><span class="cx">         except HTTPError, e:
</span><span class="cx">             self.assertEquals(e.response.code, 401)
</span><span class="cx"> 
</span><span class="lines">@@ -313,7 +262,7 @@
</span><span class="cx">                 self.fail(&quot;Incorrect response for DELETE /: %s&quot;
</span><span class="cx">                           % (response.code,))
</span><span class="cx"> 
</span><del>-        request = SimpleRequest(self.site, &quot;DELETE&quot;, &quot;/&quot;)
</del><ins>+        request = SimpleStoreRequest(self, &quot;DELETE&quot;, &quot;/&quot;)
</ins><span class="cx">         return self.send(request, do_test)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -325,8 +274,8 @@
</span><span class="cx">                 self.fail(&quot;Incorrect response for COPY /: %s&quot;
</span><span class="cx">                           % (response.code,))
</span><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;COPY&quot;,
</span><span class="cx">             &quot;/&quot;,
</span><span class="cx">             headers=http_headers.Headers({&quot;Destination&quot;: &quot;/copy/&quot;})
</span><span class="lines">@@ -342,8 +291,8 @@
</span><span class="cx">                 self.fail(&quot;Incorrect response for MOVE /: %s&quot;
</span><span class="cx">                           % (response.code,))
</span><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;MOVE&quot;,
</span><span class="cx">             &quot;/&quot;,
</span><span class="cx">             headers=http_headers.Headers({&quot;Destination&quot;: &quot;/copy/&quot;})
</span><span class="lines">@@ -371,13 +320,14 @@
</span><span class="cx">             return response
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def setUp(self):
</span><del>-        super(SACLCacheTests, self).setUp()
-        self.root.resource.responseCache = SACLCacheTests.StubResponseCacheResource()
</del><ins>+        yield super(SACLCacheTests, self).setUp()
+        self.actualRoot.responseCache = SACLCacheTests.StubResponseCacheResource()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def test_PROPFIND(self):
</span><del>-        self.root.resource.useSacls = True
</del><ins>+        self.actualRoot.useSacls = True
</ins><span class="cx"> 
</span><span class="cx">         body = &quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
</span><span class="cx"> &lt;D:propfind xmlns:D=&quot;DAV:&quot;&gt;
</span><span class="lines">@@ -388,15 +338,19 @@
</span><span class="cx"> &lt;/D:propfind&gt;
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        request = SimpleRequest(
-            self.site,
</del><ins>+        request = SimpleStoreRequest(
+            self,
</ins><span class="cx">             &quot;PROPFIND&quot;,
</span><span class="cx">             &quot;/principals/users/dreid/&quot;,
</span><del>-            headers=http_headers.Headers({
-                    'Authorization': ['basic', '%s' % ('dreid:dierd'.encode('base64'),)],
</del><ins>+            headers=http_headers.Headers(
+                {
+                    'Authorization': [
+                        'basic', '%s' % ('dreid:dierd'.encode('base64'),)
+                    ],
</ins><span class="cx">                     'Content-Type': 'application/xml; charset=&quot;utf-8&quot;',
</span><span class="cx">                     'Depth': '1',
</span><del>-            }),
</del><ins>+                }
+            ),
</ins><span class="cx">             content=body
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="lines">@@ -404,15 +358,19 @@
</span><span class="cx">             if response.code != responsecode.MULTI_STATUS:
</span><span class="cx">                 self.fail(&quot;Incorrect response for PROPFIND /principals/: %s&quot; % (response.code,))
</span><span class="cx"> 
</span><del>-            request = SimpleRequest(
-                self.site,
</del><ins>+            request = SimpleStoreRequest(
+                self,
</ins><span class="cx">                 &quot;PROPFIND&quot;,
</span><span class="cx">                 &quot;/principals/users/dreid/&quot;,
</span><del>-                headers=http_headers.Headers({
-                        'Authorization': ['basic', '%s' % ('dreid:dierd'.encode('base64'),)],
</del><ins>+                headers=http_headers.Headers(
+                    {
+                        'Authorization': [
+                            'basic', '%s' % ('dreid:dierd'.encode('base64'),)
+                        ],
</ins><span class="cx">                         'Content-Type': 'application/xml; charset=&quot;utf-8&quot;',
</span><span class="cx">                         'Depth': '1',
</span><del>-                }),
</del><ins>+                    }
+                ),
</ins><span class="cx">                 content=body
</span><span class="cx">             )
</span><span class="cx"> 
</span><span class="lines">@@ -422,7 +380,7 @@
</span><span class="cx">         def gotResponse2(response):
</span><span class="cx">             if response.code != responsecode.MULTI_STATUS:
</span><span class="cx">                 self.fail(&quot;Incorrect response for PROPFIND /principals/: %s&quot; % (response.code,))
</span><del>-            self.assertEqual(self.root.resource.responseCache.cacheHitCount, 1)
</del><ins>+            self.assertEqual(self.actualRoot.responseCache.cacheHitCount, 1)
</ins><span class="cx"> 
</span><span class="cx">         d = self.send(request, gotResponse1)
</span><span class="cx">         return d
</span><span class="lines">@@ -438,12 +396,9 @@
</span><span class="cx">         request.checkedWiki will be set to True
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        request = SimpleRequest(self.site, &quot;GET&quot;, &quot;/principals/&quot;)
</del><ins>+        request = SimpleStoreRequest(self, &quot;GET&quot;, &quot;/principals/&quot;)
</ins><span class="cx"> 
</span><span class="cx">         resrc, _ignore_segments = (yield maybeDeferred(
</span><del>-            self.root.locateChild, request, [&quot;principals&quot;]
</del><ins>+            self.actualRoot.locateChild, request, [&quot;principals&quot;]
</ins><span class="cx">         ))
</span><del>-        resrc, _ignore_segments = (yield maybeDeferred(
-            resrc.locateChild, request, [&quot;principals&quot;]
-        ))
</del><span class="cx">         self.assertTrue(request.checkedWiki)
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolscalverifypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -973,7 +973,7 @@
</span><span class="cx">             elif not record.thisServer():
</span><span class="cx">                 contents = yield self.countHomeContents(uid)
</span><span class="cx">                 wrong_server.append((uid, contents,))
</span><del>-            elif not record.enabledForCalendaring:
</del><ins>+            elif not record.hasCalendars:
</ins><span class="cx">                 contents = yield self.countHomeContents(uid)
</span><span class="cx">                 disabled.append((uid, contents,))
</span><span class="cx"> 
</span><span class="lines">@@ -1542,7 +1542,7 @@
</span><span class="cx"> 
</span><span class="cx">         if uuid not in self.validForCalendaringUUIDs:
</span><span class="cx">             record = self.directoryService().recordWithGUID(uuid)
</span><del>-            self.validForCalendaringUUIDs[uuid] = record is not None and record.enabledForCalendaring and record.thisServer()
</del><ins>+            self.validForCalendaringUUIDs[uuid] = record is not None and record.hasCalendars and record.thisServer()
</ins><span class="cx">         return self.validForCalendaringUUIDs[uuid]
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2171,7 +2171,7 @@
</span><span class="cx">             record = self.directoryService().recordWithGUID(uuid)
</span><span class="cx">             if record is None:
</span><span class="cx">                 continue
</span><del>-            if not record.thisServer() or not record.enabledForCalendaring:
</del><ins>+            if not record.thisServer() or not record.hasCalendars:
</ins><span class="cx">                 continue
</span><span class="cx"> 
</span><span class="cx">             rname = record.fullName
</span><span class="lines">@@ -2482,7 +2482,7 @@
</span><span class="cx">             record = self.directoryService().recordWithGUID(uuid)
</span><span class="cx">             if record is None:
</span><span class="cx">                 continue
</span><del>-            if not record.thisServer() or not record.enabledForCalendaring:
</del><ins>+            if not record.thisServer() or not record.hasCalendars:
</ins><span class="cx">                 continue
</span><span class="cx"> 
</span><span class="cx">             rname = record.fullName
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsexportpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/export.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/export.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/export.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> from twisted.python.text import wordWrap
</span><span class="cx"> from twisted.python.usage import Options, UsageError
</span><del>-from twisted.internet.defer import inlineCallbacks, returnValue
</del><ins>+from twisted.internet.defer import inlineCallbacks, returnValue, succeed
</ins><span class="cx"> 
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx"> from twistedcaldav.ical import Component
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     )
</span><span class="cx"> )
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class ExportOptions(Options):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Command-line options for 'calendarserver_export'
</span><span class="lines">@@ -188,7 +189,7 @@
</span><span class="cx">         Enumerate all calendars based on the directory record and/or calendars
</span><span class="cx">         for this calendar home.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        uid = self.getHomeUID(exportService)
</del><ins>+        uid = yield self.getHomeUID(exportService)
</ins><span class="cx">         home = yield txn.calendarHomeWithUID(uid, True)
</span><span class="cx">         result = []
</span><span class="cx">         if self.collections:
</span><span class="lines">@@ -218,7 +219,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def getHomeUID(self, exportService):
</span><del>-        return self.uid
</del><ins>+        return succeed(self.uid)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -244,13 +245,17 @@
</span><span class="cx">         self.shortName = shortName
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def getHomeUID(self, exportService):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Retrieve the home UID.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         directory = exportService.directoryService()
</span><del>-        record = directory.recordWithShortName(self.recordType, self.shortName)
-        return record.uid
</del><ins>+        record = yield directory.recordWithShortName(
+            directory.oldNameToRecordType(self.recordType),
+            self.shortName
+        )
+        returnValue(record.uid)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsshelldirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/directory.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/directory.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/directory.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -97,8 +97,8 @@
</span><span class="cx"> 
</span><span class="cx">     add(&quot;Server ID&quot;           , record.serverID)
</span><span class="cx">     add(&quot;Enabled&quot;             , record.enabled)
</span><del>-    add(&quot;Enabled for Calendar&quot;, record.enabledForCalendaring)
-    add(&quot;Enabled for Contacts&quot;, record.enabledForAddressBooks)
</del><ins>+    add(&quot;Enabled for Calendar&quot;, record.hasCalendars)
+    add(&quot;Enabled for Contacts&quot;, record.hasContacts)
</ins><span class="cx"> 
</span><span class="cx">     return succeed(table.toString())
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsshellvfspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/vfs.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/vfs.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/shell/vfs.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx">                 if (
</span><span class="cx">                     self.record is not None and
</span><span class="cx">                     self.service.config.EnableCalDAV and
</span><del>-                    self.record.enabledForCalendaring
</del><ins>+                    self.record.hasCalendars
</ins><span class="cx">                 ):
</span><span class="cx">                     create = True
</span><span class="cx">                 else:
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavcachepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/cache.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/cache.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/cache.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> 
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class DisabledCacheNotifier(object):
</span><span class="cx">     def __init__(self, *args, **kwargs):
</span><span class="cx">         pass
</span><span class="lines">@@ -164,6 +165,7 @@
</span><span class="cx">             raise URINotFoundException(uri)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def _canonicalizeURIForRequest(self, uri, request):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Always use canonicalized forms of the URIs for caching (i.e. __uids__ paths).
</span><span class="lines">@@ -174,21 +176,24 @@
</span><span class="cx">         uribits = uri.split(&quot;/&quot;)
</span><span class="cx">         if len(uribits) &gt; 1 and uribits[1] in (&quot;principals&quot;, &quot;calendars&quot;, &quot;addressbooks&quot;):
</span><span class="cx">             if uribits[2] == &quot;__uids__&quot;:
</span><del>-                return succeed(uri)
</del><ins>+                returnValue(uri)
</ins><span class="cx">             else:
</span><span class="cx">                 recordType = uribits[2]
</span><span class="cx">                 recordName = uribits[3]
</span><span class="cx">                 directory = request.site.resource.getDirectory()
</span><del>-                record = directory.recordWithShortName(recordType, recordName)
</del><ins>+                record = yield directory.recordWithShortName(
+                    directory.oldNameToRecordType(recordType),
+                    recordName
+                )
</ins><span class="cx">                 if record is not None:
</span><span class="cx">                     uribits[2] = &quot;__uids__&quot;
</span><del>-                    uribits[3] = record.uid
-                    return succeed(&quot;/&quot;.join(uribits))
</del><ins>+                    uribits[3] = record.uid.encode(&quot;utf-8&quot;)
+                    returnValue(&quot;/&quot;.join(uribits))
</ins><span class="cx"> 
</span><span class="cx">         # Fall back to the locateResource approach
</span><span class="cx">         try:
</span><del>-            return request.locateResource(uri).addCallback(
-                lambda resrc: resrc.url()).addErrback(self._uriNotFound, uri)
</del><ins>+            resrc = yield request.locateResource(uri)
+            returnValue(resrc.url())
</ins><span class="cx">         except AssertionError:
</span><span class="cx">             raise URINotFoundException(uri)
</span><span class="cx"> 
</span><span class="lines">@@ -252,7 +257,8 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Get the current token for a particular URI.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-
</del><ins>+        if isinstance(uri, unicode):
+            uri = uri.encode(&quot;utf-8&quot;)
</ins><span class="cx">         if cachePoolHandle:
</span><span class="cx">             result = (yield defaultCachePool(cachePoolHandle).get('cacheToken:%s' % (uri,)))
</span><span class="cx">         else:
</span><span class="lines">@@ -436,8 +442,9 @@
</span><span class="cx">                     cTokens,
</span><span class="cx">                 )
</span><span class="cx">             )
</span><del>-            yield self.getCachePool().set(key, cacheEntry,
-                expireTime=config.ResponseCacheTimeout * 60)
</del><ins>+            yield self.getCachePool().set(
+                key, cacheEntry, expireTime=config.ResponseCacheTimeout * 60
+            )
</ins><span class="cx"> 
</span><span class="cx">         except URINotFoundException, e:
</span><span class="cx">             self.log.debug(&quot;Could not locate URI: {e!r}&quot;, e=e)
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorycalendarpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/calendar.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/calendar.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/calendar.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">         if config.EnablePrincipalListings:
</span><span class="cx">             children = []
</span><span class="cx">             for record in (yield self.directory.listRecords(self.recordType)):
</span><del>-                if record.enabledForCalendaring:
</del><ins>+                if record.hasCalendars:
</ins><span class="cx">                     for shortName in record.shortNames:
</span><span class="cx">                         children.append(shortName)
</span><span class="cx">             returnValue(children)
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/util.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/util.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/util.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -212,9 +212,9 @@
</span><span class="cx">             guid = record.guid
</span><span class="cx"> 
</span><span class="cx">         addresses = set(value(&quot;addresses&quot;))
</span><del>-        if record.enabledForCalendaring:
</del><ins>+        if record.hasCalendars:
</ins><span class="cx">             addresses.add(&quot;urn:uuid:%s&quot; % (record.guid,))
</span><del>-            addresses.add(&quot;/principals/__uids__/%s/&quot; % (record.guid,))
</del><ins>+            addresses.add(&quot;/principals/__uids__/%s/&quot; % (record.uid,))
</ins><span class="cx">             addresses.add(&quot;/principals/%s/%s/&quot; % (record.recordType, record.shortNames[0],))
</span><span class="cx"> 
</span><span class="cx">         if hasattr(record.service, &quot;recordTypePrefix&quot;):
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavextensionspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/extensions.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/extensions.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/extensions.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx">             applyTo = True
</span><span class="cx"> 
</span><span class="cx">         elif child.qname() == (calendarserver_namespace, &quot;search-token&quot;):
</span><del>-            tokens.append(str(child))
</del><ins>+            tokens.append(child.toString())
</ins><span class="cx"> 
</span><span class="cx">         elif child.qname() == (calendarserver_namespace, &quot;limit&quot;):
</span><span class="cx">             try:
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavtestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py (12934 => 12935)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py        2014-03-17 23:43:49 UTC (rev 12934)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py        2014-03-18 17:55:31 UTC (rev 12935)
</span><span class="lines">@@ -32,8 +32,6 @@
</span><span class="cx"> from twistedcaldav.directory.calendar import (
</span><span class="cx">     DirectoryCalendarHomeProvisioningResource
</span><span class="cx"> )
</span><del>-from twistedcaldav.directory.principal import (
-    DirectoryPrincipalProvisioningResource)
</del><span class="cx"> from twistedcaldav.directory.util import transactionFromRequest
</span><span class="cx"> from twistedcaldav.memcacheclient import ClientFactory
</span><span class="cx"> from twistedcaldav.stdconfig import config
</span><span class="lines">@@ -46,6 +44,7 @@
</span><span class="cx"> import txweb2.dav.test.util
</span><span class="cx"> from txweb2.http import HTTPError, StatusResponse
</span><span class="cx"> import xattr
</span><ins>+from txweb2.server import Site
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> log = Logger()
</span><span class="lines">@@ -129,14 +128,9 @@
</span><span class="cx">         self._sqlCalendarStore.setDirectoryService(self.directory)
</span><span class="cx"> 
</span><span class="cx">         self.rootResource = getRootResource(config, self._sqlCalendarStore)
</span><ins>+        self.actualRoot = self.rootResource.resource.resource
+        self.site = Site(self.rootResource)
</ins><span class="cx"> 
</span><del>-        self.principalsResource = DirectoryPrincipalProvisioningResource(&quot;/principals/&quot;, self.directory)
-        self.site.resource.putChild(&quot;principals&quot;, self.principalsResource)
-        self.calendarCollection = DirectoryCalendarHomeProvisioningResource(self.directory, &quot;/calendars/&quot;, self._sqlCalendarStore)
-        self.site.resource.putChild(&quot;calendars&quot;, self.calendarCollection)
-        self.addressbookCollection = DirectoryAddressBookHomeProvisioningResource(self.directory, &quot;/addressbooks/&quot;, self._sqlCalendarStore)
-        self.site.resource.putChild(&quot;addressbooks&quot;, self.addressbookCollection)
-
</del><span class="cx">         yield self.populate()
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>