<!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>[12996] 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/12996">12996</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-03-25 21:20:21 -0700 (Tue, 25 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Until DPS gets its own store, DPS is now in the master.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertapcaldavpy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavupgradepy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavutilpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreschedulingschedulerpy">CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreutilpy">CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavdpsclientpy">CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavwhoaugmentpy">CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavwhodirectorypy">CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertapcaldavpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -124,6 +124,8 @@
</span><span class="cx">     pgServiceFromConfig, getDBPool, MemoryLimitService,
</span><span class="cx">     storeFromConfig
</span><span class="cx"> )
</span><ins>+from twisted.application.strports import service as strPortsService
+from txdav.dps.server import DirectoryProxyAMPFactory
</ins><span class="cx"> 
</span><span class="cx"> try:
</span><span class="cx">     from calendarserver.version import version
</span><span class="lines">@@ -536,7 +538,7 @@
</span><span class="cx">             )
</span><span class="cx">             self.monitor.addProcessObject(process, PARENT_ENVIRONMENT)
</span><span class="cx"> 
</span><del>-        if (config.DirectoryProxy.SocketPath != &quot;&quot;):
</del><ins>+        if config.DirectoryProxy.Enabled:
</ins><span class="cx">             log.info(&quot;Adding directory proxy service&quot;)
</span><span class="cx"> 
</span><span class="cx">             dpsArgv = [
</span><span class="lines">@@ -1871,11 +1873,29 @@
</span><span class="cx"> 
</span><span class="cx">             store.callWithNewTransactions(decorateTransaction)
</span><span class="cx"> 
</span><ins>+            # Set up AMP for DPS Server in the master instead of sidecar
+            if not config.DirectoryProxy.Enabled:
+                strPortsService(
+                    &quot;unix:{path}:mode=660&quot;.format(
+                        path=config.DirectoryProxy.SocketPath
+                    ),
+                    DirectoryProxyAMPFactory(store.directoryService())
+                ).setServiceParent(multi)
+
</ins><span class="cx">             return multi
</span><span class="cx"> 
</span><ins>+        if config.DirectoryProxy.Enabled:
+            # If the master is to act as a DPS client, and talk to the
+            # DPS sidecar:
+            directory = DirectoryProxyClientService(
+                config.DirectoryRealmName
+            )
+        else:
+            # If the master is to act as the DPS server:
+            directory = None
+
</ins><span class="cx">         ssvc = self.storageService(
</span><del>-            spawnerSvcCreator, None, uid, gid,
-            directory=DirectoryProxyClientService(config.DirectoryRealmName)
</del><ins>+            spawnerSvcCreator, None, uid, gid, directory=directory
</ins><span class="cx">         )
</span><span class="cx">         ssvc.setServiceParent(s)
</span><span class="cx">         return s
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavupgradepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -1110,8 +1110,6 @@
</span><span class="cx">     def stepWithResult(self, result):
</span><span class="cx">         if self.doPostImport:
</span><span class="cx"> 
</span><del>-            # directory = self.store.directoryService()
-
</del><span class="cx">             # Load proxy assignments from XML if specified
</span><span class="cx">             if (
</span><span class="cx">                 self.config.ProxyLoadFromFile and
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -520,10 +520,13 @@
</span><span class="cx">         # Single quotes are allowed, so we convert any double-quotes
</span><span class="cx">         # to single-quotes.
</span><span class="cx">         fullName = record.displayName.replace('&quot;', &quot;'&quot;)
</span><del>-
</del><span class="cx">         cuas = record.calendarUserAddresses
</span><ins>+        try:
+            guid = record.guid
+        except AttributeError:
+            guid = None
</ins><span class="cx"> 
</span><del>-        returnValue((fullName, record.uid, cuas))
</del><ins>+        returnValue((fullName, guid, cuas))
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreschedulingschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -320,6 +320,10 @@
</span><span class="cx">             # Verify that there is a single ATTENDEE property
</span><span class="cx">             attendees = self.calendar.getAttendees()
</span><span class="cx"> 
</span><ins>+            # FIXME, how can this be None?
+            if attendees is None:
+                print(&quot;Attendees is None&quot;, self.calendar)
+
</ins><span class="cx">             # Must have only one
</span><span class="cx">             if len(attendees) != 1:
</span><span class="cx">                 log.error(&quot;Wrong number of ATTENDEEs in calendar data: %s&quot; % (str(self.calendar),))
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -122,10 +122,14 @@
</span><span class="cx">         # in a parameter value except as the start/end delimiters.
</span><span class="cx">         # Single quotes are allowed, so we convert any double-quotes
</span><span class="cx">         # to single-quotes.
</span><ins>+        try:
+            guid = record.guid
+        except AttributeError:
+            guid = None
</ins><span class="cx">         returnValue(
</span><span class="cx">             (
</span><span class="cx">                 record.displayName.replace('&quot;', &quot;'&quot;),
</span><del>-                record.uid,
</del><ins>+                guid,
</ins><span class="cx">                 record.calendarUserAddresses,
</span><span class="cx">             )
</span><span class="cx">         )
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavdpsclientpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ## MOVE2WHO TODOs:
</span><del>-## realm from primary/user directory service
</del><span class="cx"> ## SACLs
</span><span class="cx"> ## Wiki
</span><span class="cx"> ## LDAP
</span><span class="lines">@@ -85,12 +84,6 @@
</span><span class="cx">     )
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    # MOVE2WHO: we talked about passing these in instead:
-    # def __init__(self, fieldNames, recordTypes):
-    #     self.fieldName = fieldNames
-    #     self.recordType = recordTypes
-
-
</del><span class="cx">     # MOVE2WHO needed?
</span><span class="cx">     def getGroups(self, guids=None):
</span><span class="cx">         return succeed(set())
</span><span class="lines">@@ -151,11 +144,12 @@
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def _getConnection(self):
</span><del>-        # TODO: make socket patch configurable
</del><span class="cx">         # TODO: reconnect if needed
</span><span class="cx"> 
</span><del>-        # path = config.DirectoryProxy.SocketPath
-        path = &quot;data/Logs/state/directory-proxy.sock&quot;
</del><ins>+        # FIXME:
+        from twistedcaldav.config import config
+        path = config.DirectoryProxy.SocketPath
+        # path = &quot;data/Logs/state/directory-proxy.sock&quot;
</ins><span class="cx">         if getattr(self, &quot;_connection&quot;, None) is None:
</span><span class="cx">             log.debug(&quot;Creating connection&quot;)
</span><span class="cx">             connection = (yield ClientCreator(reactor, amp.AMP).connectUNIX(path))
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavwhoaugmentpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     def recordWithUID(self, uid):
</span><span class="cx">         # MOVE2WHO, REMOVE THIS:
</span><span class="cx">         if not isinstance(uid, unicode):
</span><del>-            log.warn(&quot;Need to change uid to unicode&quot;)
</del><ins>+            # log.warn(&quot;Need to change uid to unicode&quot;)
</ins><span class="cx">             uid = uid.decode(&quot;utf-8&quot;)
</span><span class="cx"> 
</span><span class="cx">         record = yield self._directory.recordWithUID(uid)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">         # )
</span><span class="cx">         # MOVE2WHO, REMOVE THIS:
</span><span class="cx">         if not isinstance(shortName, unicode):
</span><del>-            log.warn(&quot;Need to change shortName to unicode&quot;)
</del><ins>+            # log.warn(&quot;Need to change shortName to unicode&quot;)
</ins><span class="cx">             shortName = shortName.decode(&quot;utf-8&quot;)
</span><span class="cx"> 
</span><span class="cx">         record = yield self._directory.recordWithShortName(
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">     def recordsWithEmailAddress(self, emailAddress):
</span><span class="cx">         # MOVE2WHO, REMOVE THIS:
</span><span class="cx">         if not isinstance(emailAddress, unicode):
</span><del>-            log.warn(&quot;Need to change emailAddress to unicode&quot;)
</del><ins>+            # log.warn(&quot;Need to change emailAddress to unicode&quot;)
</ins><span class="cx">             emailAddress = emailAddress.decode(&quot;utf-8&quot;)
</span><span class="cx"> 
</span><span class="cx">         records = yield self._directory.recordsWithEmailAddress(emailAddress)
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py (12995 => 12996)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py        2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py        2014-03-26 04:20:21 UTC (rev 12996)
</span><span class="lines">@@ -79,7 +79,8 @@
</span><span class="cx">                     uid = parts[3]
</span><span class="cx">                     record = yield self.recordWithUID(uid)
</span><span class="cx">                 else:
</span><del>-                    recordType = self.fieldName.lookupByName(parts[2])
</del><ins>+                    # recordType = self.fieldName.lookupByName(parts[2])
+                    recordType = self.oldNameToRecordType(parts[2])
</ins><span class="cx">                     record = yield self.recordWithShortName(recordType, parts[3])
</span><span class="cx"> 
</span><span class="cx">         returnValue(record if record and record.hasCalendars else None)
</span><span class="lines">@@ -406,11 +407,19 @@
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def autoAcceptFromOrganizer(self, organizer):
</span><del>-        if organizer is not None and self.autoAcceptGroup is not None:
</del><ins>+        try:
+            autoAcceptGroup = self.autoAcceptGroup
+        except AttributeError:
+            autoAcceptGroup = None
+
+        if (
+            organizer is not None and
+            autoAcceptGroup is not None
+        ):
</ins><span class="cx">             service = self.service
</span><span class="cx">             organizerRecord = yield service.recordWithCalendarUserAddress(organizer)
</span><span class="cx">             if organizerRecord is not None:
</span><del>-                autoAcceptGroup = yield service.recordWithUID(self.autoAcceptGroup)
</del><ins>+                autoAcceptGroup = yield service.recordWithUID(autoAcceptGroup)
</ins><span class="cx">                 if organizerRecord.uid in (yield autoAcceptGroup.members()):
</span><span class="cx">                     returnValue(True)
</span><span class="cx">         returnValue(False)
</span></span></pre>
</div>
</div>

</body>
</html>