[CalendarServer-changes] [11608] CalendarServer/branches/users/cdaboo/fix-no-ischedule
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 15 13:44:21 PDT 2013
Revision: 11608
http://trac.calendarserver.org//changeset/11608
Author: cdaboo at apple.com
Date: 2013-08-15 13:44:21 -0700 (Thu, 15 Aug 2013)
Log Message:
-----------
Allowing podding to work without having to have iSchedule turned on. Fix some iSChedule/podding bugs relating to detecting
which server an attendee is on, as well as how cu-addresses are normalized/unnormalized.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/fix-no-ischedule/calendarserver/tap/util.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/twistedcaldav/stdconfig.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/caldav/scheduler.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/delivery.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/resource.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/test/test_delivery.py
CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/scheduler.py
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/calendarserver/tap/util.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/calendarserver/tap/util.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -635,11 +635,23 @@
addSystemEventTrigger("after", "startup", timezoneStdService.onStartup)
#
- # iSchedule service
+ # iSchedule service for podding
#
+ if config.Servers.Enabled:
+ log.info("Setting up iSchedule podding inbox resource: {cls}", cls=iScheduleResourceClass)
+
+ ischedule = iScheduleResourceClass(
+ root,
+ newStore,
+ podding=True
+ )
+ root.putChild(config.Servers.InboxName, ischedule)
+
+ #
+ # iSchedule service (not used for podding)
+ #
if config.Scheduling.iSchedule.Enabled:
- log.info("Setting up iSchedule inbox resource: {cls}",
- cls=iScheduleResourceClass)
+ log.info("Setting up iSchedule inbox resource: {cls}", cls=iScheduleResourceClass)
ischedule = iScheduleResourceClass(
root,
@@ -650,8 +662,7 @@
# Do DomainKey resources
DKIMUtils.validConfiguration(config)
if config.Scheduling.iSchedule.DKIM.Enabled:
- log.info("Setting up domainkey resource: {res}",
- res=DomainKeyResource)
+ log.info("Setting up domainkey resource: {res}", res=DomainKeyResource)
domain = config.Scheduling.iSchedule.DKIM.Domain if config.Scheduling.iSchedule.DKIM.Domain else config.ServerHostName
dk = DomainKeyResource(
domain,
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/twistedcaldav/stdconfig.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/twistedcaldav/stdconfig.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -799,9 +799,10 @@
# Support multiple hosts within a domain
#
"Servers" : {
- "Enabled": False, # Multiple servers/partitions enabled or not
- "ConfigFile": "localservers.xml", # File path for server information
- "MaxClients": 5, # Pool size for connections to each partition
+ "Enabled": False, # Multiple servers/partitions enabled or not
+ "ConfigFile": "localservers.xml", # File path for server information
+ "MaxClients": 5, # Pool size for connections to each partition
+ "InboxName": "podding", # Name for top-level inbox resource
},
"ServerPartitionID": "", # Unique ID for this server's partition instance.
@@ -1029,9 +1030,10 @@
configDict = ConfigDict(configDict)
# Now check for Includes and parse and add each of those
if "Includes" in configDict:
+ configRoot = os.path.join(configDict.ServerRoot, configDict.ConfigRoot)
for include in configDict.Includes:
# Includes are not relative to ConfigRoot
- path = _expandPath(include)
+ path = _expandPath(fullServerPath(configRoot, include))
if os.path.exists(path):
additionalDict = ConfigDict(self._parseConfigFromFile(path))
if additionalDict:
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/caldav/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/caldav/scheduler.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/caldav/scheduler.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -101,6 +101,14 @@
"No principal for originator",
))
else:
+ if not (originatorPrincipal.calendarsEnabled() and originatorPrincipal.thisServer()):
+ log.err("Originator not enabled or hosted on this server: %s" % (self.originator,))
+ raise HTTPError(self.errorResponse(
+ responsecode.FORBIDDEN,
+ self.errorElements["originator-denied"],
+ "Originator cannot be scheduled",
+ ))
+
self.originator = LocalCalendarUser(self.originator, originatorPrincipal)
@@ -127,7 +135,7 @@
else:
# Map recipient to their inbox
inbox = None
- if principal.calendarsEnabled() and principal.thisServer():
+ if principal.calendarsEnabled():
if principal.locallyHosted():
recipient_home = yield self.txn.calendarHomeWithUID(principal.uid, create=True)
if recipient_home:
@@ -138,7 +146,7 @@
if inbox:
results.append(calendarUserFromPrincipal(recipient, principal, inbox))
else:
- log.error("No schedule inbox for principal: %s" % (principal,))
+ log.error("Recipient not enabled for calendaring: %s" % (principal,))
results.append(InvalidCalendarUser(recipient))
self.recipients = results
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/delivery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/delivery.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/delivery.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -72,6 +72,7 @@
class ScheduleViaISchedule(DeliveryService):
domainServerMap = {}
+ servermgr = None
@classmethod
def serviceType(cls):
@@ -82,9 +83,7 @@
@inlineCallbacks
def matchCalendarUserAddress(cls, cuaddr):
- # TODO: here is where we would attempt service discovery based on the cuaddr.
-
- # Only handle mailtos:
+ # Handle mailtos:
if cuaddr.lower().startswith("mailto:"):
domain = extractEmailDomain(cuaddr)
server = (yield cls.serverForDomain(domain))
@@ -100,25 +99,30 @@
def serverForDomain(cls, domain):
if domain not in cls.domainServerMap:
- # First check built-in list of remote servers
- servermgr = IScheduleServers()
- server = servermgr.mapDomain(domain)
- if server is not None:
- cls.domainServerMap[domain] = server
- else:
- # Lookup domain
- result = (yield lookupServerViaSRV(domain))
- if result is None:
+ if config.Scheduling.iSchedule.Enabled:
+
+ # First check built-in list of remote servers
+ if cls.servermgr is None:
+ cls.servermgr = IScheduleServers()
+ server = cls.servermgr.mapDomain(domain)
+ if server is not None:
+ cls.domainServerMap[domain] = server
+ else:
# Lookup domain
- result = (yield lookupServerViaSRV(domain, service="_ischedule"))
+ result = (yield lookupServerViaSRV(domain))
if result is None:
- cls.domainServerMap[domain] = None
+ # Lookup domain
+ result = (yield lookupServerViaSRV(domain, service="_ischedule"))
+ if result is None:
+ cls.domainServerMap[domain] = None
+ else:
+ # Create the iSchedule server record for this server
+ cls.domainServerMap[domain] = IScheduleServerRecord(uri="http://%s:%s/.well-known/ischedule" % result)
else:
# Create the iSchedule server record for this server
- cls.domainServerMap[domain] = IScheduleServerRecord(uri="http://%s:%s/.well-known/ischedule" % result)
- else:
- # Create the iSchedule server record for this server
- cls.domainServerMap[domain] = IScheduleServerRecord(uri="https://%s:%s/.well-known/ischedule" % result)
+ cls.domainServerMap[domain] = IScheduleServerRecord(uri="https://%s:%s/.well-known/ischedule" % result)
+ else:
+ cls.domainServerMap[domain] = None
returnValue(cls.domainServerMap[domain])
@@ -189,9 +193,12 @@
partition = recipient.principal.partitionURI()
if partition not in self.partitionedServers:
- self.partitionedServers[partition] = IScheduleServerRecord(uri=joinURL(partition, "/ischedule"))
- self.partitionedServers[partition].unNormalizeAddresses = False
- self.partitionedServers[partition].moreHeaders.append(recipient.principal.server().secretHeader())
+ self.partitionedServers[partition] = IScheduleServerRecord(
+ uri=joinURL(partition, config.Servers.InboxName),
+ unNormalizeAddresses=False,
+ moreHeaders=[recipient.principal.server().secretHeader(), ],
+ podding=True,
+ )
return self.partitionedServers[partition]
@@ -203,9 +210,12 @@
serverURI = recipient.principal.serverURI()
if serverURI not in self.otherServers:
- self.otherServers[serverURI] = IScheduleServerRecord(uri=joinURL(serverURI, "/ischedule"))
- self.otherServers[serverURI].unNormalizeAddresses = not recipient.principal.server().isImplicit
- self.otherServers[serverURI].moreHeaders.append(recipient.principal.server().secretHeader())
+ self.otherServers[serverURI] = IScheduleServerRecord(
+ uri=joinURL(serverURI, config.Servers.InboxName),
+ unNormalizeAddresses=not recipient.principal.server().isImplicit,
+ moreHeaders=[recipient.principal.server().secretHeader(), ],
+ podding=True,
+ )
return self.otherServers[serverURI]
@@ -222,6 +232,7 @@
self.refreshOnly = refreshOnly
self.headers = None
self.data = None
+ self.original_organizer = None
@inlineCallbacks
@@ -365,7 +376,8 @@
# The Originator must be the ORGANIZER (for a request) or ATTENDEE (for a reply)
originator = self.scheduler.organizer.cuaddr if self.scheduler.isiTIPRequest else self.scheduler.attendee
- originator = normalizeCUAddress(originator, normalizationLookup, self.scheduler.txn.directoryService().recordWithCalendarUserAddress, toUUID=False)
+ if self.server.unNormalizeAddresses:
+ originator = normalizeCUAddress(originator, normalizationLookup, self.scheduler.txn.directoryService().recordWithCalendarUserAddress, toUUID=False)
self.headers.addRawHeader("Originator", utf8String(originator))
self.sign_headers.append("Originator")
@@ -414,15 +426,15 @@
"""
if self.data is None:
+
# Need to remap cuaddrs from urn:uuid
- if self.server.unNormalizeAddresses and self.scheduler.method == "PUT":
- normalizedCalendar = self.scheduler.calendar.duplicate()
+ normalizedCalendar = self.scheduler.calendar.duplicate()
+ self.original_organizer = normalizedCalendar.getOrganizer()
+ if self.server.unNormalizeAddresses:
normalizedCalendar.normalizeCalendarUserAddresses(
normalizationLookup,
self.scheduler.txn.directoryService().recordWithCalendarUserAddress,
toUUID=False)
- else:
- normalizedCalendar = self.scheduler.calendar
# For VFREEBUSY we need to strip out ATTENDEEs that do not match the recipient list
if self.scheduler.isfreebusy:
@@ -445,13 +457,12 @@
f = Factory()
f.protocol = HTTPClientProtocol
if ssl:
- ep = GAIEndpoint(reactor, host, port,
- _configuredClientContextFactory())
+ ep = GAIEndpoint(reactor, host, port, _configuredClientContextFactory())
else:
ep = GAIEndpoint(reactor, host, port)
proto = (yield ep.connect(f))
- if config.Scheduling.iSchedule.DKIM.Enabled:
+ if not self.server.podding() and config.Scheduling.iSchedule.DKIM.Enabled:
domain, selector, key_file, algorithm, useDNSKey, useHTTPKey, usePrivateExchangeKey, expire = DKIMUtils.getConfiguration(config)
request = DKIMRequest(
"POST",
@@ -503,6 +514,14 @@
calendar_data = response.childOfType(CalendarData)
if calendar_data:
calendar_data = str(calendar_data)
+ if self.server.unNormalizeAddresses and self.original_organizer is not None:
+ # Need to restore original ORGANIZER value if it got unnormalized
+ calendar = Component.fromString(calendar_data)
+ organizers = calendar.getAllPropertiesInAnyComponent("ORGANIZER", depth=1)
+ for organizer in organizers:
+ organizer.setValue(self.original_organizer)
+ calendar_data = str(calendar)
+
error = response.childOfType(Error)
if error:
error = error.children
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -138,7 +138,7 @@
"""
Contains server-to-server details.
"""
- def __init__(self, uri=None):
+ def __init__(self, uri=None, unNormalizeAddresses=True, moreHeaders=[], podding=False):
"""
@param recordType: record type for directory entry.
"""
@@ -148,8 +148,9 @@
self.allow_to = True
self.domains = []
self.client_hosts = []
- self.unNormalizeAddresses = True
- self.moreHeaders = []
+ self.unNormalizeAddresses = unNormalizeAddresses
+ self.moreHeaders = moreHeaders
+ self._podding = podding
if uri:
self.uri = uri
@@ -160,6 +161,10 @@
return (self.ssl, self.host, self.port, self.path,)
+ def podding(self):
+ return self._podding
+
+
def redirect(self, location):
"""
Permanent redirect for the lifetime of this record.
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/resource.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/resource.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -52,7 +52,7 @@
Extends L{DAVResource} to provide iSchedule inbox functionality.
"""
- def __init__(self, parent, store):
+ def __init__(self, parent, store, podding=False):
"""
@param parent: the parent resource of this one.
"""
@@ -62,6 +62,7 @@
self.parent = parent
self._newStore = store
+ self._podding = podding
def deadProperties(self):
@@ -109,12 +110,12 @@
def render(self, request):
output = """<html>
<head>
-<title>Server To Server Inbox Resource</title>
+<title>%(rtype)s Inbox Resource</title>
</head>
<body>
-<h1>Server To Server Inbox Resource.</h1>
+<h1>%(rtype)s Inbox Resource.</h1>
</body
-</html>"""
+</html>""" % {"rtype" : "Podding" if self._podding else "iSchedule", }
response = Response(200, {}, output)
response.headers.setHeader("content-type", MimeType("text", "html"))
@@ -126,7 +127,7 @@
The iSchedule GET method.
"""
- if not request.args:
+ if not request.args or self._podding:
# Do normal GET behavior
return self.render(request)
@@ -220,7 +221,7 @@
txn = transactionFromRequest(request, self._newStore)
# This is a server-to-server scheduling operation.
- scheduler = IScheduleScheduler(txn, None)
+ scheduler = IScheduleScheduler(txn, None, podding=self._podding)
originator = self.loadOriginatorFromRequestHeaders(request)
recipients = self.loadRecipientsFromRequestHeaders(request)
@@ -236,7 +237,8 @@
else:
yield txn.commit()
response = result.response()
- response.headers.addRawHeader(ISCHEDULE_CAPABILITIES, str(config.Scheduling.iSchedule.SerialNumber))
+ if not self._podding:
+ response.headers.addRawHeader(ISCHEDULE_CAPABILITIES, str(config.Scheduling.iSchedule.SerialNumber))
returnValue(response)
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/scheduler.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/scheduler.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -119,6 +119,9 @@
class IScheduleScheduler(RemoteScheduler):
+ """
+ Handles iSchedule and podding requests.
+ """
scheduleResponse = IScheduleResponseQueue
@@ -138,6 +141,11 @@
"max-recipients": (ischedule_namespace, "max-recipients"),
}
+ def __init__(self, txn, originator_uid, logItems=None, noAttendeeRefresh=False, podding=False):
+ super(IScheduleScheduler, self).__init__(txn, originator_uid, logItems=logItems, noAttendeeRefresh=noAttendeeRefresh)
+ self._podding = podding
+
+
@inlineCallbacks
def doSchedulingViaPOST(self, remoteAddr, headers, body, originator, recipients):
"""
@@ -148,7 +156,7 @@
self.headers = headers
self.verified = False
- if config.Scheduling.iSchedule.DKIM.Enabled:
+ if not self._podding and config.Scheduling.iSchedule.DKIM.Enabled:
verifier = DKIMVerifier(self.headers, body, protocol_debug=config.Scheduling.iSchedule.DKIM.ProtocolDebug)
try:
yield verifier.verify()
@@ -174,11 +182,16 @@
calendar = Component.fromString(body)
- if self.headers.getRawHeaders('x-calendarserver-itip-refreshonly', ("F"))[0] == "T":
+ if self._podding and self.headers.getRawHeaders('x-calendarserver-itip-refreshonly', ("F"))[0] == "T":
self.txn.doing_attendee_refresh = 1
# Normalize recipient addresses
- recipients = [normalizeCUAddress(recipient, normalizationLookup, self.txn.directoryService().recordWithCalendarUserAddress) for recipient in recipients]
+ results = []
+ for recipient in recipients:
+ normalized = normalizeCUAddress(recipient, normalizationLookup, self.txn.directoryService().recordWithCalendarUserAddress)
+ self.recipientsNormalizationMap[normalized] = recipient
+ results.append(normalized)
+ recipients = results
result = (yield super(IScheduleScheduler, self).doSchedulingViaPOST(originator, recipients, calendar))
returnValue(result)
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/test/test_delivery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/test/test_delivery.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/ischedule/test/test_delivery.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -42,6 +42,7 @@
Make sure we do an exact comparison on EmailDomain
"""
+ self.patch(config.Scheduling.iSchedule, "Enabled", True)
self.patch(config.Scheduling.iSchedule, "RemoteServers", "")
# Only mailtos:
@@ -64,3 +65,9 @@
self.assertFalse(result)
result = yield ScheduleViaISchedule.matchCalendarUserAddress("mailto:user")
self.assertFalse(result)
+
+ # Test when not enabled
+ ScheduleViaISchedule.domainServerMap = {}
+ self.patch(config.Scheduling.iSchedule, "Enabled", False)
+ result = yield ScheduleViaISchedule.matchCalendarUserAddress("mailto:user at example.com")
+ self.assertFalse(result)
Modified: CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/scheduler.py 2013-08-15 20:18:51 UTC (rev 11607)
+++ CalendarServer/branches/users/cdaboo/fix-no-ischedule/txdav/caldav/datastore/scheduling/scheduler.py 2013-08-15 20:44:21 UTC (rev 11608)
@@ -142,6 +142,7 @@
self.originator = None
self.recipients = None
+ self.recipientsNormalizationMap = {}
self.calendar = None
self.organizer = None
self.attendee = None
@@ -232,51 +233,6 @@
returnValue(result)
- @inlineCallbacks
- def loadFromRequestData(self):
- self.loadOriginatorFromRequestDetails()
- self.loadRecipientsFromCalendarData()
-
-
- def loadOriginatorFromRequestDetails(self):
- # Get the originator who is the authenticated user
- originatorPrincipal = self.txn.directoryService().recordWithUID(self.originator_uid)
-
- # Pick the canonical CUA:
- originator = originatorPrincipal.canonicalCalendarUserAddress() if originatorPrincipal else ""
-
- if not originator:
- log.error("%s request must have Originator" % (self.method,))
- raise HTTPError(self.errorResponse(
- responsecode.FORBIDDEN,
- self.errorElements["originator-missing"],
- "Missing originator",
- ))
- else:
- self.originator = originator
-
-
- def loadRecipientsFromCalendarData(self):
-
- # Get the ATTENDEEs
- attendees = list()
- unique_set = set()
- for attendee, _ignore in self.calendar.getAttendeesByInstance():
- if attendee not in unique_set:
- attendees.append(attendee)
- unique_set.add(attendee)
-
- if not attendees:
- log.error("%s request must have at least one Recipient" % (self.method,))
- raise HTTPError(self.errorResponse(
- responsecode.FORBIDDEN,
- self.errorElements["recipient-missing"],
- "Must have recipients",
- ))
- else:
- self.recipients = list(attendees)
-
-
def preProcessCalendarData(self):
"""
After loading calendar data from the request, do some optional processing of it. This method will be
@@ -474,7 +430,7 @@
freebusy = self.checkForFreeBusy()
# Prepare for multiple responses
- responses = self.scheduleResponse(self.method, responsecode.OK)
+ responses = self.scheduleResponse(self.method, responsecode.OK, self.mapRecipientAddress)
# Loop over each recipient and aggregate into lists by service types.
caldav_recipients = []
@@ -577,7 +533,11 @@
return requestor.generateSchedulingResponses()
+ def mapRecipientAddress(self, cuaddr):
+ return self.recipientsNormalizationMap.get(cuaddr, cuaddr)
+
+
class RemoteScheduler(Scheduler):
def checkOrganizer(self):
@@ -703,7 +663,7 @@
response_description_element = davxml.ResponseDescription
calendar_data_element = caldavxml.CalendarData
- def __init__(self, method, success_response):
+ def __init__(self, method, success_response, recipient_mapper=None):
"""
@param method: the name of the method generating the queue.
@param success_response: the response to return in lieu of a
@@ -712,6 +672,7 @@
self.responses = []
self.method = method
self.success_response = success_response
+ self.recipient_mapper = recipient_mapper
self.location = None
@@ -745,6 +706,9 @@
else:
raise AssertionError("Unknown data type: %r" % (what,))
+ if self.recipient_mapper is not None:
+ recipient = self.recipient_mapper(recipient)
+
if not suppressErrorLog and code > 400: # Error codes only
self.log.error("Error during %s for %s: %s" % (self.method, recipient, message))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130815/2a951703/attachment-0001.html>
More information about the calendarserver-changes
mailing list