[CalendarServer-changes] [12552] CalendarServer/trunk/txdav/dps
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:24:36 PDT 2014
Revision: 12552
http://trac.calendarserver.org//changeset/12552
Author: sagen at apple.com
Date: 2014-02-04 10:39:54 -0800 (Tue, 04 Feb 2014)
Log Message:
-----------
Add more directory proxy commands
Modified Paths:
--------------
CalendarServer/trunk/txdav/dps/client.py
CalendarServer/trunk/txdav/dps/protocol.py
CalendarServer/trunk/txdav/dps/service.py
Modified: CalendarServer/trunk/txdav/dps/client.py
===================================================================
--- CalendarServer/trunk/txdav/dps/client.py 2014-02-04 18:14:29 UTC (rev 12551)
+++ CalendarServer/trunk/txdav/dps/client.py 2014-02-04 18:39:54 UTC (rev 12552)
@@ -34,6 +34,8 @@
print("guid: {r}".format(r=record))
records = (yield ds.recordsWithRecordType(RecordType.user))
print("recordType: {r}".format(r=records))
+ records = (yield ds.recordsWithEmailAddress("cdaboo at bitbucket.calendarserver.org"))
+ print("emailAddress: {r}".format(r=records))
def succeeded(result):
Modified: CalendarServer/trunk/txdav/dps/protocol.py
===================================================================
--- CalendarServer/trunk/txdav/dps/protocol.py 2014-02-04 18:14:29 UTC (rev 12551)
+++ CalendarServer/trunk/txdav/dps/protocol.py 2014-02-04 18:39:54 UTC (rev 12552)
@@ -119,7 +119,7 @@
@RecordWithShortNameCommand.responder
@inlineCallbacks
def recordWithShortName(self, recordType, shortName):
- recordType = recordType.decode("utf-8")
+ recordType = recordType # keep as bytes
shortName = shortName.decode("utf-8")
log.debug("RecordWithShortName: {r} {n}", r=recordType, n=shortName)
record = (yield self._directory.recordWithShortName(
@@ -164,7 +164,7 @@
@RecordsWithRecordTypeCommand.responder
@inlineCallbacks
def recordsWithRecordType(self, recordType):
- recordType = recordType.decode("utf-8")
+ recordType = recordType # as bytes
log.debug("RecordsWithRecordType: {r}", r=recordType)
records = (yield self._directory.recordsWithRecordType(
RecordType.lookupByName(recordType))
@@ -177,3 +177,19 @@
}
log.debug("Responding with: {response}", response=response)
returnValue(response)
+
+
+ @RecordsWithEmailAddressCommand.responder
+ @inlineCallbacks
+ def recordsWithEmailAddress(self, emailAddress):
+ emailAddress = emailAddress.decode("utf-8")
+ log.debug("RecordsWithEmailAddress: {e}", e=emailAddress)
+ records = (yield self._directory.recordsWithEmailAddress(emailAddress))
+ fieldsList = []
+ for record in records:
+ fieldsList.append(self.recordToDict(record))
+ response = {
+ "fieldsList": pickle.dumps(fieldsList),
+ }
+ log.debug("Responding with: {response}", response=response)
+ returnValue(response)
Modified: CalendarServer/trunk/txdav/dps/service.py
===================================================================
--- CalendarServer/trunk/txdav/dps/service.py 2014-02-04 18:14:29 UTC (rev 12551)
+++ CalendarServer/trunk/txdav/dps/service.py 2014-02-04 18:39:54 UTC (rev 12552)
@@ -37,7 +37,8 @@
from .protocol import (
DirectoryProxyAMPProtocol, RecordWithShortNameCommand, RecordWithUIDCommand,
- RecordWithGUIDCommand, RecordsWithRecordTypeCommand
+ RecordWithGUIDCommand, RecordsWithRecordTypeCommand,
+ RecordsWithEmailAddressCommand
)
from twisted.internet import reactor
@@ -160,6 +161,20 @@
return d
+ def recordsWithEmailAddress(self, emailAddress):
+
+ def _call(ampProto):
+ return ampProto.callRemote(
+ RecordsWithEmailAddressCommand,
+ emailAddress=emailAddress
+ )
+
+ d = self._getConnection()
+ d.addCallback(_call)
+ d.addCallback(self._processMultipleRecords)
+ return d
+
+
class DirectoryRecord(BaseDirectoryRecord):
pass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/620f1c0b/attachment.html>
More information about the calendarserver-changes
mailing list