<!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>[14307] CalendarServer/trunk</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/14307">14307</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-01-15 10:11:02 -0800 (Thu, 15 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix and simplify cross-pod requests.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkrequirementsdevtxt">CalendarServer/trunk/requirements-dev.txt</a></li>
<li><a href="#CalendarServertrunktwistedcaldavstorebridgepy">CalendarServer/trunk/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduleschedulerpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavicalendarstorepy">CalendarServer/trunk/txdav/caldav/icalendarstore.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingattachmentspy">CalendarServer/trunk/txdav/common/datastore/podding/attachments.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingconduitpy">CalendarServer/trunk/txdav/common/datastore/podding/conduit.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingdirectorypy">CalendarServer/trunk/txdav/common/datastore/podding/directory.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingrequestpy">CalendarServer/trunk/txdav/common/datastore/podding/request.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingresourcepy">CalendarServer/trunk/txdav/common/datastore/podding/resource.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingsharing_basepy">CalendarServer/trunk/txdav/common/datastore/podding/sharing_base.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingsharing_invitespy">CalendarServer/trunk/txdav/common/datastore/podding/sharing_invites.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingsharing_storepy">CalendarServer/trunk/txdav/common/datastore/podding/sharing_store.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingtesttest_conduitpy">CalendarServer/trunk/txdav/common/datastore/podding/test/test_conduit.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingtesttest_resourcepy">CalendarServer/trunk/txdav/common/datastore/podding/test/test_resource.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastorepoddingtestutilpy">CalendarServer/trunk/txdav/common/datastore/podding/test/util.py</a></li>
<li><a href="#CalendarServertrunktxdavwhocachepy">CalendarServer/trunk/txdav/who/cache.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodelegatespy">CalendarServer/trunk/txdav/who/delegates.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodirectorypy">CalendarServer/trunk/txdav/who/directory.py</a></li>
<li><a href="#CalendarServertrunktxdavwhogroupspy">CalendarServer/trunk/txdav/who/groups.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkrequirementsdevtxt"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/requirements-dev.txt (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/requirements-dev.txt        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/requirements-dev.txt        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -8,4 +8,4 @@
</span><span class="cx"> q
</span><span class="cx"> tl.eggdeps
</span><span class="cx"> --editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@13420#egg=CalDAVClientLibrary
</span><del>---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14300#egg=CalDAVTester
</del><ins>+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14306#egg=CalDAVTester
</ins></span></pre></div>
<a id="CalendarServertrunktwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/storebridge.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/storebridge.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -2850,7 +2850,7 @@
</span><span class="cx">
</span><span class="cx"> # Look for client fixes
</span><span class="cx"> ua = request.headers.getHeader("User-Agent")
</span><del>- client_fix_transp = matchClientFixes(config, ua)
</del><ins>+ client_fix_transp = "ForceAttendeeTRANSP" in matchClientFixes(config, ua)
</ins><span class="cx">
</span><span class="cx"> # Setup options
</span><span class="cx"> options = {
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduleschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -376,7 +376,7 @@
</span><span class="cx">
</span><span class="cx"> # Check against this server.
</span><span class="cx"> matched = False
</span><del>- serversDB = self.txn._store.directoryService().serversDB
</del><ins>+ serversDB = self.txn._store.directoryService().serversDB()
</ins><span class="cx"> if serversDB.getThisServer().checkThisIP(clientip):
</span><span class="cx"> matched = True
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavicalendarstorepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/icalendarstore.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/icalendarstore.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/caldav/icalendarstore.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -953,7 +953,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><del>-class SetComponentOptions(Names):
</del><ins>+class SetComponentOptions(object):
</ins><span class="cx"> """
</span><span class="cx"> Constants for keys used in the L{ICalendarObject.setComponent} method's
</span><span class="cx"> C{options} dict. The definitions below define the constant key name and
</span><span class="lines">@@ -966,14 +966,18 @@
</span><span class="cx"> Value: L{bool}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- smartMerge = NamedConstant()
- smartMerge.description = u"Smart Merge: CalDAV If-Schedule-Tag-Match behavior"
- smartMerge.defaultValue = False
</del><ins>+ # Smart Merge: CalDAV If-Schedule-Tag-Match behavior
+ smartMerge = "smartMerge"
</ins><span class="cx">
</span><del>- clientFixTRANSP = NamedConstant()
- clientFixTRANSP.description = u"Fix for clients not setting TRANSP"
- clientFixTRANSP.defaultValue = False
</del><ins>+ # Fix for clients not setting TRANSP
+ clientFixTRANSP = "clientFixTRANSP"
</ins><span class="cx">
</span><ins>+ _defaults = {
+ smartMerge: False,
+ clientFixTRANSP: False
+ }
+
</ins><span class="cx"> @staticmethod
</span><span class="cx"> def value(options, key):
</span><del>- return options.get(key, key.defaultValue) if options is not None else key.defaultValue
</del><ins>+ defaultValue = SetComponentOptions._defaults.get(key)
+ return options.get(key, defaultValue) if options is not None else defaultValue
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingattachmentspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/attachments.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/attachments.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/attachments.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -15,7 +15,6 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><del>-from twisted.python.reflect import namedClass
</del><span class="cx">
</span><span class="cx">
</span><span class="cx"> class AttachmentsPoddingConduitMixin(object):
</span><span class="lines">@@ -48,13 +47,9 @@
</span><span class="cx"> request["filename"] = filename
</span><span class="cx">
</span><span class="cx"> response = yield self.sendRequest(shareeView._txn, recipient, request, stream, content_type)
</span><ins>+ returnValue(response)
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(response["value"])
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_add_attachment(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -64,26 +59,15 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- actionName = "add-attachment"
- _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request, actionName)
- try:
- attachment, location = yield objectResource.addAttachment(
- request["rids"],
- request["streamType"],
- request["filename"],
- request["stream"],
- )
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request)
+ attachment, location = yield objectResource.addAttachment(
+ request["rids"],
+ request["streamType"],
+ request["filename"],
+ request["stream"],
+ )
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- "value": (attachment.managedID(), location,),
- })
</del><ins>+ returnValue((attachment.managedID(), location,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -110,13 +94,9 @@
</span><span class="cx"> request["filename"] = filename
</span><span class="cx">
</span><span class="cx"> response = yield self.sendRequest(shareeView._txn, recipient, request, stream, content_type)
</span><ins>+ returnValue(response)
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(response["value"])
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_update_attachment(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -126,26 +106,15 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- actionName = "update-attachment"
- _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request, actionName)
- try:
- attachment, location = yield objectResource.updateAttachment(
- request["managedID"],
- request["streamType"],
- request["filename"],
- request["stream"],
- )
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request)
+ attachment, location = yield objectResource.updateAttachment(
+ request["managedID"],
+ request["streamType"],
+ request["filename"],
+ request["stream"],
+ )
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- "value": (attachment.managedID(), location,),
- })
</del><ins>+ returnValue((attachment.managedID(), location,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -167,14 +136,9 @@
</span><span class="cx"> request["rids"] = rids
</span><span class="cx"> request["managedID"] = managed_id
</span><span class="cx">
</span><del>- response = yield self.sendRequest(shareeView._txn, recipient, request)
</del><ins>+ yield self.sendRequest(shareeView._txn, recipient, request)
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(response["value"])
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_remove_attachment(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -184,21 +148,8 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- actionName = "remove-attachment"
- _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request, actionName)
- try:
- yield objectResource.removeAttachment(
- request["rids"],
- request["managedID"],
- )
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
-
- returnValue({
- "result": "ok",
- "value": None,
- })
</del><ins>+ _ignore_shareeView, objectResource = yield self._getResourcesForRequest(txn, request)
+ yield objectResource.removeAttachment(
+ request["rids"],
+ request["managedID"],
+ )
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingconduitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/conduit.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/conduit.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/conduit.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -16,8 +16,6 @@
</span><span class="cx">
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx">
</span><del>-from twisted.internet.defer import inlineCallbacks, returnValue
-
</del><span class="cx"> from txdav.common.idirectoryservice import DirectoryRecordNotFoundError
</span><span class="cx"> from txdav.common.datastore.podding.attachments import AttachmentsPoddingConduitMixin
</span><span class="cx"> from txdav.common.datastore.podding.base import FailedCrossPodRequestError
</span><span class="lines">@@ -26,7 +24,11 @@
</span><span class="cx"> from txdav.common.datastore.podding.sharing_invites import SharingInvitesPoddingConduitMixin
</span><span class="cx"> from txdav.common.datastore.podding.sharing_store import SharingStorePoddingConduitMixin
</span><span class="cx">
</span><ins>+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.python.reflect import namedClass
+from twisted.python.failure import Failure
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> log = Logger()
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -114,7 +116,12 @@
</span><span class="cx"> response = (yield request.doRequest(txn))
</span><span class="cx"> except Exception as e:
</span><span class="cx"> raise FailedCrossPodRequestError("Failed cross-pod request: {}".format(e))
</span><del>- returnValue(response)
</del><ins>+ if response["result"] == "exception":
+ raise namedClass(response["class"])(response["result"])
+ elif response["result"] != "ok":
+ raise FailedCrossPodRequestError("Cross-pod request failed: {}".format(response))
+ else:
+ returnValue(response.get("value"))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -146,11 +153,15 @@
</span><span class="cx">
</span><span class="cx"> # Do the actual request processing
</span><span class="cx"> try:
</span><del>- result = (yield getattr(self, method)(txn, data))
</del><ins>+ value = (yield getattr(self, method)(txn, data))
+ result = {"result": "ok"}
+ if value is not None:
+ result["value"] = value
</ins><span class="cx"> except Exception as e:
</span><ins>+ ex = Failure()
</ins><span class="cx"> yield txn.abort()
</span><span class="cx"> log.error("Failed action: {action}, {ex}", action=action, ex=e)
</span><del>- raise FailedCrossPodRequestError("Failed action: {}, {}".format(action, e))
</del><ins>+ ex.raiseException()
</ins><span class="cx">
</span><span class="cx"> yield txn.commit()
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingdirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/directory.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/directory.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/directory.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -15,7 +15,6 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><del>-from twisted.python.reflect import namedClass
</del><span class="cx"> from txdav.common.datastore.podding.base import FailedCrossPodRequestError
</span><span class="cx"> from txdav.who.delegates import Delegates
</span><span class="cx">
</span><span class="lines">@@ -41,13 +40,9 @@
</span><span class="cx"> "action": "all-group-delegates",
</span><span class="cx"> }
</span><span class="cx"> response = yield self.sendRequestToServer(txn, server, request)
</span><ins>+ returnValue(set(response))
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(set(response["value"]))
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_all_group_delegates(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -57,24 +52,11 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "all-group-delegates":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_all_group_delegates".format(request["action"]))
</del><ins>+ delegatedUIDs = yield txn.allGroupDelegates()
</ins><span class="cx">
</span><del>- try:
- delegatedUIDs = yield txn.allGroupDelegates()
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ returnValue(list(delegatedUIDs))
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- "value": list(delegatedUIDs),
- })
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def send_set_delegates(self, txn, delegator, delegates, readWrite):
</span><span class="cx"> """
</span><span class="lines">@@ -98,14 +80,9 @@
</span><span class="cx"> "delegates": [delegate.uid for delegate in delegates],
</span><span class="cx"> "read-write": readWrite,
</span><span class="cx"> }
</span><del>- response = yield self.sendRequestToServer(txn, delegator.server(), request)
</del><ins>+ yield self.sendRequestToServer(txn, delegator.server(), request)
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(None)
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_set_delegates(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -115,34 +92,20 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "set-delegates":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_set_delegates".format(request["action"]))
</del><ins>+ delegator = yield txn.directoryService().recordWithUID(request["uid"])
+ if delegator is None or not delegator.thisServer():
+ raise FailedCrossPodRequestError("Cross-pod delegate not on this server: {}".format(delegator.uid))
</ins><span class="cx">
</span><del>- try:
- delegator = yield txn.directoryService().recordWithUID(request["uid"])
- if delegator is None or not delegator.thisServer():
- raise FailedCrossPodRequestError("Cross-pod delegate not on this server: {}".format(delegator.uid))
</del><ins>+ delegates = []
+ for uid in request["delegates"]:
+ delegate = yield txn.directoryService().recordWithUID(uid)
+ if delegate is None:
+ raise FailedCrossPodRequestError("Cross-pod delegate missing on this server: {}".format(uid))
+ delegates.append(delegate)
</ins><span class="cx">
</span><del>- delegates = []
- for uid in request["delegates"]:
- delegate = yield txn.directoryService().recordWithUID(uid)
- if delegate is None:
- raise FailedCrossPodRequestError("Cross-pod delegate missing on this server: {}".format(uid))
- delegates.append(delegate)
</del><ins>+ yield Delegates.setDelegates(txn, delegator, delegates, request["read-write"])
</ins><span class="cx">
</span><del>- yield Delegates.setDelegates(txn, delegator, delegates, request["read-write"])
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- })
-
-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def send_get_delegates(self, txn, delegator, readWrite, expanded=False):
</span><span class="cx"> """
</span><span class="lines">@@ -165,13 +128,9 @@
</span><span class="cx"> "expanded": expanded,
</span><span class="cx"> }
</span><span class="cx"> response = yield self.sendRequestToServer(txn, delegator.server(), request)
</span><ins>+ returnValue(set(response))
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(set(response["value"]))
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_get_delegates(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -181,28 +140,15 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "get-delegates":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_get_delegates".format(request["action"]))
</del><ins>+ delegator = yield txn.directoryService().recordWithUID(request["uid"])
+ if delegator is None or not delegator.thisServer():
+ raise FailedCrossPodRequestError("Cross-pod delegate not on this server: {}".format(delegator.uid))
</ins><span class="cx">
</span><del>- try:
- delegator = yield txn.directoryService().recordWithUID(request["uid"])
- if delegator is None or not delegator.thisServer():
- raise FailedCrossPodRequestError("Cross-pod delegate not on this server: {}".format(delegator.uid))
</del><ins>+ delegates = yield Delegates._delegatesOfUIDs(txn, delegator, request["read-write"], request["expanded"])
</ins><span class="cx">
</span><del>- delegates = yield Delegates._delegatesOfUIDs(txn, delegator, request["read-write"], request["expanded"])
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ returnValue(list(delegates))
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- "value": list(delegates),
- })
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def send_get_delegators(self, txn, server, delegate, readWrite):
</span><span class="cx"> """
</span><span class="lines">@@ -226,13 +172,9 @@
</span><span class="cx"> "read-write": readWrite,
</span><span class="cx"> }
</span><span class="cx"> response = yield self.sendRequestToServer(txn, server, request)
</span><ins>+ returnValue(set(response))
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue(set(response["value"]))
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_get_delegators(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -242,23 +184,10 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "get-delegators":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_get_delegators".format(request["action"]))
</del><ins>+ delegate = yield txn.directoryService().recordWithUID(request["uid"])
+ if delegate is None or delegate.thisServer():
+ raise FailedCrossPodRequestError("Cross-pod delegate missing or on this server: {}".format(delegate.uid))
</ins><span class="cx">
</span><del>- try:
- delegate = yield txn.directoryService().recordWithUID(request["uid"])
- if delegate is None or delegate.thisServer():
- raise FailedCrossPodRequestError("Cross-pod delegate missing or on this server: {}".format(delegate.uid))
</del><ins>+ delegators = yield Delegates._delegatedToUIDs(txn, delegate, request["read-write"], onlyThisServer=True)
</ins><span class="cx">
</span><del>- delegateors = yield Delegates._delegatedToUIDs(txn, delegate, request["read-write"], onlyThisServer=True)
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
-
- returnValue({
- "result": "ok",
- "value": list(delegateors),
- })
</del><ins>+ returnValue(list(delegators))
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingrequestpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/request.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/request.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/request.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> self.loggedResponse = yield self.logResponse(response)
</span><span class="cx"> emitAccounting("xPod", "", self.loggedRequest + "\n" + self.loggedResponse, "POST")
</span><span class="cx">
</span><del>- if response.code in (responsecode.OK,):
</del><ins>+ if response.code in (responsecode.OK, responsecode.BAD_REQUEST,):
</ins><span class="cx"> data = (yield allDataFromStream(response.stream))
</span><span class="cx"> data = json.loads(data)
</span><span class="cx"> else:
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingresourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/resource.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/resource.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/resource.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> deliverSchedulePrivilegeSet
</span><span class="cx">
</span><span class="cx"> from txdav.xml import element as davxml
</span><del>-from txdav.common.datastore.podding.conduit import FailedCrossPodRequestError
</del><span class="cx">
</span><span class="cx"> import base64
</span><span class="cx"> import json
</span><span class="lines">@@ -119,7 +118,7 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Check shared secret
</span><del>- if not self.store.directoryService().serversDB.getThisServer().checkSharedSecret(request.headers):
</del><ins>+ if not self.store.directoryService().serversDB().getThisServer().checkSharedSecret(request.headers):
</ins><span class="cx"> self.log.error("Invalid shared secret header in cross-pod request")
</span><span class="cx"> raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Not authorized to make this request"))
</span><span class="cx">
</span><span class="lines">@@ -158,12 +157,17 @@
</span><span class="cx"> # Get the conduit to process the data
</span><span class="cx"> try:
</span><span class="cx"> result = yield self.store.conduit.processRequest(j)
</span><del>- except FailedCrossPodRequestError as e:
- raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
</del><ins>+ code = responsecode.OK
</ins><span class="cx"> except Exception as e:
</span><del>- raise HTTPError(StatusResponse(responsecode.INTERNAL_SERVER_ERROR, str(e)))
</del><ins>+ # Send the exception over to the other side
+ result = {
+ "result": "exception",
+ "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
+ "request": str(e),
+ }
+ code = responsecode.BAD_REQUEST
</ins><span class="cx">
</span><del>- response = JSONResponse(responsecode.OK, result)
</del><ins>+ response = JSONResponse(code, result)
</ins><span class="cx"> returnValue(response)
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingsharing_basepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/sharing_base.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/sharing_base.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/sharing_base.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def _getResourcesForRequest(self, txn, request, expected_action):
</del><ins>+ def _getResourcesForRequest(self, txn, request):
</ins><span class="cx"> """
</span><span class="cx"> Find the resources associated with the request. This is used when a JSON request has been received
</span><span class="cx"> and the underlying store objects the request refers to need to be found.
</span><span class="lines">@@ -67,9 +67,6 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != expected_action:
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_{}".format(request["action"], expected_action))
-
</del><span class="cx"> # Get a share
</span><span class="cx"> ownerHome = yield txn.homeWithUID(request["type"], request["owner"])
</span><span class="cx"> if ownerHome is None or ownerHome.external():
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingsharing_invitespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/sharing_invites.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/sharing_invites.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/sharing_invites.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -14,9 +14,8 @@
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><span class="cx">
</span><del>-from twisted.internet.defer import inlineCallbacks, returnValue
</del><ins>+from twisted.internet.defer import inlineCallbacks
</ins><span class="cx">
</span><del>-from txdav.common.icommondatastore import ExternalShareFailed
</del><span class="cx"> from txdav.common.datastore.podding.base import FailedCrossPodRequestError
</span><span class="cx"> from txdav.common.datastore.podding.sharing_base import SharingCommonPoddingConduit
</span><span class="cx">
</span><span class="lines">@@ -71,8 +70,7 @@
</span><span class="cx"> if supported_components is not None:
</span><span class="cx"> request["supported-components"] = supported_components
</span><span class="cx">
</span><del>- result = yield self.sendRequest(txn, recipient, request)
- returnValue(result)
</del><ins>+ yield self.sendRequest(txn, recipient, request)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -84,34 +82,24 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "shareinvite":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_shareinvite".format(request["action"]))
-
</del><span class="cx"> # Sharee home on this pod must exist (create if needed)
</span><span class="cx"> shareeHome = yield txn.homeWithUID(request["type"], request["sharee"], create=True)
</span><span class="cx"> if shareeHome is None or shareeHome.external():
</span><span class="cx"> raise FailedCrossPodRequestError("Invalid sharee UID specified")
</span><span class="cx">
</span><span class="cx"> # Create a share
</span><del>- try:
- yield shareeHome.processExternalInvite(
- request["owner"],
- request["owner_id"],
- request["owner_name"],
- request["share_id"],
- request["mode"],
- request["summary"],
- request["properties"],
- supported_components=request.get("supported-components")
- )
- except ExternalShareFailed as e:
- raise FailedCrossPodRequestError(str(e))
</del><ins>+ yield shareeHome.processExternalInvite(
+ request["owner"],
+ request["owner_id"],
+ request["owner_name"],
+ request["share_id"],
+ request["mode"],
+ request["summary"],
+ request["properties"],
+ supported_components=request.get("supported-components")
+ )
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- })
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def send_shareuninvite(self, txn, homeType, ownerUID, ownerID, shareeUID, shareUID):
</span><span class="cx"> """
</span><span class="lines">@@ -140,8 +128,7 @@
</span><span class="cx"> "share_id": shareUID,
</span><span class="cx"> }
</span><span class="cx">
</span><del>- result = yield self.sendRequest(txn, recipient, request)
- returnValue(result)
</del><ins>+ yield self.sendRequest(txn, recipient, request)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -153,29 +140,19 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "shareuninvite":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_shareuninvite".format(request["action"]))
-
</del><span class="cx"> # Sharee home on this pod must already exist
</span><span class="cx"> shareeHome = yield txn.homeWithUID(request["type"], request["sharee"])
</span><span class="cx"> if shareeHome is None or shareeHome.external():
</span><span class="cx"> FailedCrossPodRequestError("Invalid sharee UID specified")
</span><span class="cx">
</span><span class="cx"> # Remove a share
</span><del>- try:
- yield shareeHome.processExternalUninvite(
- request["owner"],
- request["owner_id"],
- request["share_id"],
- )
- except ExternalShareFailed as e:
- FailedCrossPodRequestError(str(e))
</del><ins>+ yield shareeHome.processExternalUninvite(
+ request["owner"],
+ request["owner_id"],
+ request["share_id"],
+ )
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- })
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def send_sharereply(self, txn, homeType, ownerUID, shareeUID, shareUID, bindStatus, summary=None):
</span><span class="cx"> """
</span><span class="lines">@@ -208,8 +185,7 @@
</span><span class="cx"> if summary is not None:
</span><span class="cx"> request["summary"] = summary
</span><span class="cx">
</span><del>- result = yield self.sendRequest(txn, recipient, request)
- returnValue(result)
</del><ins>+ yield self.sendRequest(txn, recipient, request)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -221,26 +197,16 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if request["action"] != "sharereply":
- raise FailedCrossPodRequestError("Wrong action '{}' for recv_sharereply".format(request["action"]))
-
</del><span class="cx"> # Sharer home on this pod must already exist
</span><span class="cx"> ownerHome = yield txn.homeWithUID(request["type"], request["owner"])
</span><span class="cx"> if ownerHome is None or ownerHome.external():
</span><span class="cx"> FailedCrossPodRequestError("Invalid owner UID specified")
</span><span class="cx">
</span><span class="cx"> # Process a reply
</span><del>- try:
- yield ownerHome.processExternalReply(
- request["owner"],
- request["sharee"],
- request["share_id"],
- request["status"],
- summary=request.get("summary")
- )
- except ExternalShareFailed as e:
- FailedCrossPodRequestError(str(e))
-
- returnValue({
- "result": "ok",
- })
</del><ins>+ yield ownerHome.processExternalReply(
+ request["owner"],
+ request["sharee"],
+ request["share_id"],
+ request["status"],
+ summary=request.get("summary")
+ )
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingsharing_storepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/sharing_store.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/sharing_store.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/sharing_store.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -15,7 +15,6 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><del>-from twisted.python.reflect import namedClass
</del><span class="cx">
</span><span class="cx"> from txdav.common.datastore.podding.sharing_base import SharingCommonPoddingConduit
</span><span class="cx"> from txdav.caldav.datastore.scheduling.freebusy import generateFreeBusyInfo
</span><span class="lines">@@ -59,10 +58,7 @@
</span><span class="cx"> if kwargs is not None:
</span><span class="cx"> request["keywords"] = kwargs
</span><span class="cx"> response = yield self.sendRequest(shareeView._txn, recipient, request)
</span><del>- if response["result"] == "ok":
- returnValue(response["value"] if transform is None else transform(response["value"], shareeView, objectResource))
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><ins>+ returnValue(response if transform is None else transform(response, shareeView, objectResource))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -81,29 +77,19 @@
</span><span class="cx"> @type transform: C{callable}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- shareeView, objectResource = yield self._getResourcesForRequest(txn, request, actionName)
- try:
- if onHomeChild:
- # Operate on the L{CommonHomeChild}
- value = yield getattr(shareeView, method)(*request.get("arguments", ()), **request.get("keywords", {}))
</del><ins>+ shareeView, objectResource = yield self._getResourcesForRequest(txn, request)
+ if onHomeChild:
+ # Operate on the L{CommonHomeChild}
+ value = yield getattr(shareeView, method)(*request.get("arguments", ()), **request.get("keywords", {}))
+ else:
+ # Operate on the L{CommonObjectResource}
+ if objectResource is not None:
+ value = yield getattr(objectResource, method)(*request.get("arguments", ()), **request.get("keywords", {}))
</ins><span class="cx"> else:
</span><del>- # Operate on the L{CommonObjectResource}
- if objectResource is not None:
- value = yield getattr(objectResource, method)(*request.get("arguments", ()), **request.get("keywords", {}))
- else:
- # classmethod call
- value = yield getattr(shareeView._objectResourceClass, method)(shareeView, *request.get("arguments", ()), **request.get("keywords", {}))
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ # classmethod call
+ value = yield getattr(shareeView._objectResourceClass, method)(shareeView, *request.get("arguments", ()), **request.get("keywords", {}))
</ins><span class="cx">
</span><del>- returnValue({
- "result": "ok",
- "value": transform(value, shareeView, objectResource) if transform is not None else value,
- })
</del><ins>+ returnValue(transform(value, shareeView, objectResource) if transform is not None else value)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -134,13 +120,9 @@
</span><span class="cx"> action["event_details"] = event_details
</span><span class="cx">
</span><span class="cx"> response = yield self.sendRequest(calresource._txn, recipient, action)
</span><ins>+ returnValue((response["fbresults"], response["matchtotal"],))
</ins><span class="cx">
</span><del>- if response["result"] == "ok":
- returnValue((response["fbresults"], response["matchtotal"],))
- elif response["result"] == "exception":
- raise namedClass(response["class"])(response["result"])
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def recv_freebusy(self, txn, request):
</span><span class="cx"> """
</span><span class="lines">@@ -150,37 +132,30 @@
</span><span class="cx"> @type request: C{dict}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- shareeView, _ignore_objectResource = yield self._getResourcesForRequest(txn, request, "freebusy")
- try:
- # Operate on the L{CommonHomeChild}
- fbinfo = [[], [], []]
- matchtotal = yield generateFreeBusyInfo(
- shareeView,
- fbinfo,
- TimeRange(start=request["timerange"][0], end=request["timerange"][1]),
- request["matchtotal"],
- request["excludeuid"],
- request["organizer"],
- request["organizerPrincipal"],
- request["same_calendar_user"],
- request["servertoserver"],
- request["event_details"],
- logItems=None
- )
- except Exception as e:
- returnValue({
- "result": "exception",
- "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
- "request": str(e),
- })
</del><ins>+ # Operate on the L{CommonHomeChild}
+ shareeView, _ignore_objectResource = yield self._getResourcesForRequest(txn, request)
</ins><span class="cx">
</span><ins>+ fbinfo = [[], [], []]
+ matchtotal = yield generateFreeBusyInfo(
+ shareeView,
+ fbinfo,
+ TimeRange(start=request["timerange"][0], end=request["timerange"][1]),
+ request["matchtotal"],
+ request["excludeuid"],
+ request["organizer"],
+ request["organizerPrincipal"],
+ request["same_calendar_user"],
+ request["servertoserver"],
+ request["event_details"],
+ logItems=None
+ )
+
</ins><span class="cx"> # Convert L{DateTime} objects to text for JSON response
</span><span class="cx"> for i in range(3):
</span><span class="cx"> for j in range(len(fbinfo[i])):
</span><span class="cx"> fbinfo[i][j] = fbinfo[i][j].getText()
</span><span class="cx">
</span><span class="cx"> returnValue({
</span><del>- "result": "ok",
</del><span class="cx"> "fbresults": fbinfo,
</span><span class="cx"> "matchtotal": matchtotal,
</span><span class="cx"> })
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingtesttest_conduitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/test/test_conduit.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/test/test_conduit.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/test/test_conduit.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -52,7 +52,6 @@
</span><span class="cx">
</span><span class="cx"> def recv_fake(self, j):
</span><span class="cx"> return succeed({
</span><del>- "result": "ok",
</del><span class="cx"> "back2u": j["echo"],
</span><span class="cx"> "more": "bits",
</span><span class="cx"> })
</span><span class="lines">@@ -149,7 +148,6 @@
</span><span class="cx">
</span><span class="cx"> def recv_fake(self, txn, j):
</span><span class="cx"> return succeed({
</span><del>- "result": "ok",
</del><span class="cx"> "back2u": j["echo"],
</span><span class="cx"> "more": "bits",
</span><span class="cx"> })
</span><span class="lines">@@ -173,23 +171,13 @@
</span><span class="cx"> txn = self.transactionUnderTest()
</span><span class="cx"> store1 = self.storeUnderTest()
</span><span class="cx"> response = yield store1.conduit.send_fake(txn, "user01", "puser01")
</span><del>- self.assertTrue("result" in response)
- self.assertEqual(response["result"], "ok")
- self.assertTrue("back2u" in response)
- self.assertEqual(response["back2u"], "bravo")
- self.assertTrue("more" in response)
- self.assertEqual(response["more"], "bits")
</del><ins>+ self.assertEqual(response, {"back2u": "bravo", "more": "bits"})
</ins><span class="cx"> yield txn.commit()
</span><span class="cx">
</span><span class="cx"> store2 = self.otherStoreUnderTest()
</span><span class="cx"> txn = store2.newTransaction()
</span><span class="cx"> response = yield store2.conduit.send_fake(txn, "puser01", "user01")
</span><del>- self.assertTrue("result" in response)
- self.assertEqual(response["result"], "ok")
- self.assertTrue("back2u" in response)
- self.assertEqual(response["back2u"], "bravo")
- self.assertTrue("more" in response)
- self.assertEqual(response["more"], "bits")
</del><ins>+ self.assertEqual(response, {"back2u": "bravo", "more": "bits"})
</ins><span class="cx"> yield txn.commit()
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingtesttest_resourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/test/test_resource.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/test/test_resource.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/test/test_resource.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx">
</span><span class="cx"> def recv_fake(self, txn, j):
</span><span class="cx"> return succeed({
</span><del>- "result": "ok",
</del><span class="cx"> "back2u": j["echo"],
</span><span class="cx"> "more": "bits",
</span><span class="cx"> })
</span><span class="lines">@@ -266,7 +265,5 @@
</span><span class="cx"> j = json.loads(data)
</span><span class="cx"> self.assertTrue("result" in j)
</span><span class="cx"> self.assertEqual(j["result"], "ok")
</span><del>- self.assertTrue("back2u" in j)
- self.assertEqual(j["back2u"], "bravo")
- self.assertTrue("more" in j)
- self.assertEqual(j["more"], "bits")
</del><ins>+ self.assertTrue("value" in j)
+ self.assertEqual(j["value"], {"back2u": "bravo", "more": "bits"})
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastorepoddingtestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/podding/test/util.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/podding/test/util.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/common/datastore/podding/test/util.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -89,7 +89,15 @@
</span><span class="cx"> if self.stream is not None:
</span><span class="cx"> j["stream"] = self.stream
</span><span class="cx"> j["streamType"] = self.streamType
</span><del>- result = yield store.conduit.processRequest(j)
</del><ins>+ try:
+ result = yield store.conduit.processRequest(j)
+ except Exception as e:
+ # Send the exception over to the other side
+ result = {
+ "result": "exception",
+ "class": ".".join((e.__class__.__module__, e.__class__.__name__,)),
+ "request": str(e),
+ }
</ins><span class="cx"> result = json.dumps(result)
</span><span class="cx"> returnValue(result)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhocachepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/cache.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/cache.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/who/cache.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -473,6 +473,10 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><ins>+ def serversDB(self):
+ return self._directory.serversDB()
+
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def flush(self):
</span><span class="cx"> self.resetCache()
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodelegatespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/delegates.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/delegates.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/who/delegates.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -614,7 +614,7 @@
</span><span class="cx"> log.debug("_podDelegators for: {} and read-write = {}".format(delegate.uid, readWrite,))
</span><span class="cx"> results = yield DeferredList([
</span><span class="cx"> txn.store().conduit.send_get_delegators(txn, server, delegate, readWrite) for
</span><del>- server in txn.directoryService().serversDB.allServersExceptThis()
</del><ins>+ server in txn.directoryService().serversDB().allServersExceptThis()
</ins><span class="cx"> ], consumeErrors=True)
</span><span class="cx"> delegators = set()
</span><span class="cx"> for result in results:
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/directory.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/directory.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/who/directory.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -53,10 +53,14 @@
</span><span class="cx">
</span><span class="cx"> guid = "1332A615-4D3A-41FE-B636-FBE25BFB982E"
</span><span class="cx">
</span><del>- serversDB = None
</del><ins>+ _serversDB = None
</ins><span class="cx">
</span><ins>+ def serversDB(self):
+ return self._serversDB
+
+
</ins><span class="cx"> def setServersDB(self, serversDB):
</span><del>- self.serversDB = serversDB
</del><ins>+ self._serversDB = serversDB
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> # Must maintain the hack for a bit longer:
</span><span class="lines">@@ -502,10 +506,10 @@
</span><span class="cx"> URL of the server hosting this record. Return None if hosted on this server.
</span><span class="cx"> """
</span><span class="cx"> if (
</span><del>- self.service.serversDB is not None and
</del><ins>+ self.service.serversDB() is not None and
</ins><span class="cx"> getattr(self, "serviceNodeUID", None)
</span><span class="cx"> ):
</span><del>- return self.service.serversDB.getServerURIById(self.serviceNodeUID)
</del><ins>+ return self.service.serversDB().getServerURIById(self.serviceNodeUID)
</ins><span class="cx"> else:
</span><span class="cx"> return None
</span><span class="cx">
</span><span class="lines">@@ -515,10 +519,10 @@
</span><span class="cx"> Server hosting this record. Return None if hosted on this server.
</span><span class="cx"> """
</span><span class="cx"> if (
</span><del>- self.service.serversDB is not None and
</del><ins>+ self.service.serversDB() is not None and
</ins><span class="cx"> getattr(self, "serviceNodeUID", None)
</span><span class="cx"> ):
</span><del>- return self.service.serversDB.getServerById(self.serviceNodeUID)
</del><ins>+ return self.service.serversDB().getServerById(self.serviceNodeUID)
</ins><span class="cx"> else:
</span><span class="cx"> return None
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhogroupspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/groups.py (14306 => 14307)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/groups.py        2015-01-15 17:56:24 UTC (rev 14306)
+++ CalendarServer/trunk/txdav/who/groups.py        2015-01-15 18:11:02 UTC (rev 14307)
</span><span class="lines">@@ -533,10 +533,10 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # Also get group delegates from other pods
</span><del>- if txn.directoryService().serversDB is not None and len(txn.directoryService().serversDB.allServersExceptThis()) != 0:
</del><ins>+ if txn.directoryService().serversDB() is not None and len(txn.directoryService().serversDB().allServersExceptThis()) != 0:
</ins><span class="cx"> results = yield DeferredList([
</span><span class="cx"> txn.store().conduit.send_all_group_delegates(txn, server) for
</span><del>- server in txn.directoryService().serversDB.allServersExceptThis()
</del><ins>+ server in txn.directoryService().serversDB().allServersExceptThis()
</ins><span class="cx"> ], consumeErrors=True)
</span><span class="cx"> for result in results:
</span><span class="cx"> if result and result[0]:
</span></span></pre>
</div>
</div>
</body>
</html>