<!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>[13517] CalendarServer/trunk/txdav/caldav/datastore/scheduling</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/13517">13517</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-05-20 11:50:48 -0700 (Tue, 20 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix some ischedule/dkim issues. Change % -> format style strs/logging.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingcaldavdeliverypy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingcaldavschedulerpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingcuaddresspy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/cuaddress.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingdeliverypy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/delivery.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimipdeliverypy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimipsmtpsenderpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/smtpsender.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduledeliverypy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduledkimpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/dkim.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischedulelocalserverspy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/localservers.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduleremoteserverspy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduleresourcepy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/resource.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduleschedulerpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduletestdatadbexamplecom">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.example.com</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischeduleutilspy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingischedulexmlpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/xml.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingschedulerpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingcaldavdeliverypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def generateResponse(self, recipient, responses):
</span><span class="cx"> # Hash the iCalendar data for use as the last path element of the URI path
</span><del>- name = "%s-%s.ics" % (hashlib.md5(self.scheduler.calendar.resourceUID()).hexdigest(), str(uuid.uuid4())[:8],)
</del><ins>+ name = "{hash}-{r}.ics".format(hash=hashlib.md5(self.scheduler.calendar.resourceUID()).hexdigest(), r=str(uuid.uuid4())[:8],)
</ins><span class="cx">
</span><span class="cx"> # Do implicit scheduling message processing.
</span><span class="cx"> try:
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingcaldavschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -78,7 +78,10 @@
</span><span class="cx"> def checkAuthorization(self):
</span><span class="cx"> # Must have an authenticated user
</span><span class="cx"> if not self.internal_request and self.originator_uid == None:
</span><del>- log.error("Unauthenticated originators not allowed: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Unauthenticated originators not allowed: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -96,7 +99,10 @@
</span><span class="cx"> originatorAddress = yield calendarUserFromCalendarUserAddress(self.originator, self.txn)
</span><span class="cx"> if not originatorAddress.hosted():
</span><span class="cx"> # Local requests MUST have a principal.
</span><del>- log.error("Could not find principal for originator: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Could not find principal for originator: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -104,7 +110,10 @@
</span><span class="cx"> ))
</span><span class="cx"> else:
</span><span class="cx"> if not originatorAddress.validOriginator() or isinstance(originatorAddress, OtherServerCalendarUser):
</span><del>- log.error("Originator not enabled or hosted on this server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Originator not enabled or hosted on this server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -131,7 +140,7 @@
</span><span class="cx"> # user. Also if server-to-server is not enabled then remote addresses are not allowed.
</span><span class="cx"> if not recipientAddress.hosted():
</span><span class="cx"> if isinstance(recipientAddress, InvalidCalendarUser):
</span><del>- log.error("Unknown calendar user address: %s" % (recipient,))
</del><ins>+ log.error("Unknown calendar user address: {r}", r=recipient,)
</ins><span class="cx"> results.append(recipientAddress)
</span><span class="cx"> else:
</span><span class="cx"> # Map recipient to their inbox and cache on calendar user object
</span><span class="lines">@@ -148,7 +157,7 @@
</span><span class="cx"> if inbox:
</span><span class="cx"> results.append(recipientAddress)
</span><span class="cx"> else:
</span><del>- log.error("No scheduling for calendar user: %s" % (recipient,))
</del><ins>+ log.error("No scheduling for calendar user: {r}", r=recipient,)
</ins><span class="cx"> results.append(InvalidCalendarUser(recipient))
</span><span class="cx">
</span><span class="cx"> self.recipients = results
</span><span class="lines">@@ -171,7 +180,7 @@
</span><span class="cx"> # to be handled later when we know whether a new invite is being added
</span><span class="cx"> # (which we reject) vs an update to an existing one (which we allow).
</span><span class="cx"> if self.checkForFreeBusy() and not organizerAddress.record.enabledAsOrganizer():
</span><del>- log.error("ORGANIZER not allowed to be an Organizer: %s" % (self.calendar,))
</del><ins>+ log.error("ORGANIZER not allowed to be an Organizer: {cal}", cal=self.calendar,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -180,7 +189,7 @@
</span><span class="cx">
</span><span class="cx"> self.organizer = organizerAddress
</span><span class="cx"> else:
</span><del>- log.error("No scheduling for ORGANIZER: %s" % (organizer,))
</del><ins>+ log.error("No scheduling for ORGANIZER: {o}", o=organizer,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -189,7 +198,7 @@
</span><span class="cx"> else:
</span><span class="cx"> localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(organizer))
</span><span class="cx"> if localUser:
</span><del>- log.error("No principal for ORGANIZER in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error("No principal for ORGANIZER in calendar data: {cal}", cal=self.calendar,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -198,7 +207,7 @@
</span><span class="cx"> else:
</span><span class="cx"> self.organizer = organizerAddress
</span><span class="cx"> else:
</span><del>- log.error("ORGANIZER missing in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error("ORGANIZER missing in calendar data: {cal}", cal=self.calendar,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -210,7 +219,7 @@
</span><span class="cx">
</span><span class="cx"> # Make sure that the ORGANIZER is local
</span><span class="cx"> if not isinstance(self.organizer, LocalCalendarUser):
</span><del>- log.error("ORGANIZER is not local to server in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error("ORGANIZER is not local to server in calendar data: {cal}", cal=self.calendar,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -219,7 +228,7 @@
</span><span class="cx">
</span><span class="cx"> # Make sure that the ORGANIZER's is the request URI owner
</span><span class="cx"> if self.doingPOST is not None and self.organizer.record.uid != self.originator_uid:
</span><del>- log.error("Wrong outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error("Wrong outbox for ORGANIZER in calendar data: {cal}", cal=self.calendar,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -238,14 +247,14 @@
</span><span class="cx"> attendeeAddress = yield calendarUserFromCalendarUserAddress(self.attendee, self.txn)
</span><span class="cx"> if attendeeAddress.hosted():
</span><span class="cx"> if self.doingPOST is not None and attendeeAddress.record.uid != self.originator_uid:
</span><del>- log.error("ATTENDEE in calendar data does not match owner of Outbox: %s" % (self.attendee,))
</del><ins>+ log.error("ATTENDEE in calendar data does not match owner of Outbox: {a}", a=self.attendee,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["attendee-denied"],
</span><span class="cx"> "Outbox does not belong to attendee",
</span><span class="cx"> ))
</span><span class="cx"> else:
</span><del>- log.error("Unknown ATTENDEE in calendar data: %s" % (self.attendee,))
</del><ins>+ log.error("Unknown ATTENDEE in calendar data: {a}", a=self.attendee,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["attendee-denied"],
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingcuaddresspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/cuaddress.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/cuaddress.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/cuaddress.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __str__(self):
</span><del>- return "Local calendar user: %s" % (self.cuaddr,)
</del><ins>+ return "Local calendar user: {}".format(self.cuaddr)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __str__(self):
</span><del>- return "Other server calendar user: %s" % (self.cuaddr,)
</del><ins>+ return "Other server calendar user: {}".format(self.cuaddr)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __str__(self):
</span><del>- return "Remote calendar user: %s" % (self.cuaddr,)
</del><ins>+ return "Remote calendar user: {}".format(self.cuaddr)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def extractDomain(self):
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __str__(self):
</span><del>- return "Email/iMIP calendar user: %s" % (self.cuaddr,)
</del><ins>+ return "Email/iMIP calendar user: {}".format(self.cuaddr)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> def __str__(self):
</span><del>- return "Invalid calendar user: %s" % (self.cuaddr,)
</del><ins>+ return "Invalid calendar user: {}".format(self.cuaddr)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def validOriginator(self):
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingdeliverypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/delivery.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/delivery.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/delivery.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -69,7 +69,11 @@
</span><span class="cx"> if re.match(pattern, cuaddr) is not None:
</span><span class="cx"> return succeed(True)
</span><span class="cx"> except re.error:
</span><del>- log.error("Invalid regular expression for Scheduling configuration '%s/LocalAddresses': %s" % (cls.serviceType(), pattern,))
</del><ins>+ log.error(
+ "Invalid regular expression for Scheduling configuration '{stype}/LocalAddresses': {pat}",
+ stype=cls.serviceType(),
+ pat=pattern,
+ )
</ins><span class="cx">
</span><span class="cx"> return succeed(False)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimipdeliverypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/delivery.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -76,12 +76,15 @@
</span><span class="cx"> "CANCEL",
</span><span class="cx"> "DECLINE_COUNTER",
</span><span class="cx"> ):
</span><del>- log.info("Could not do server-to-imip method: %s" % (method,))
</del><ins>+ log.info(
+ "Could not do server-to-imip method: {method}",
+ method=method,
+ )
</ins><span class="cx"> for recipient in self.recipients:
</span><span class="cx"> err = HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (caldav_namespace, "recipient-failed"),
</span><del>- "iMIP method not allowed: %s" % (method,),
</del><ins>+ "iMIP method not allowed: {}".format(method,),
</ins><span class="cx"> ))
</span><span class="cx"> self.responses.add(
</span><span class="cx"> recipient.cuaddr,
</span><span class="lines">@@ -96,11 +99,16 @@
</span><span class="cx"> try:
</span><span class="cx"> toAddr = str(recipient.cuaddr)
</span><span class="cx"> if not toAddr.lower().startswith("mailto:"):
</span><del>- raise ValueError("ATTENDEE address '%s' must be mailto: for iMIP operation." % (toAddr,))
</del><ins>+ raise ValueError("ATTENDEE address '{}' must be mailto: for iMIP operation.".format(toAddr,))
</ins><span class="cx">
</span><span class="cx"> fromAddr = str(self.scheduler.originator.cuaddr)
</span><span class="cx">
</span><del>- log.debug("Submitting iMIP message... To: '%s', From :'%s'\n%s" % (toAddr, fromAddr, caldata,))
</del><ins>+ log.debug(
+ "Submitting iMIP message... To: '{to}', From :'{fr}'\n{data}",
+ to=toAddr,
+ fr=fromAddr,
+ data=caldata,
+ )
</ins><span class="cx">
</span><span class="cx"> def enqueueOp(txn):
</span><span class="cx"> return txn.enqueue(IMIPInvitationWork, fromAddr=fromAddr,
</span><span class="lines">@@ -108,14 +116,19 @@
</span><span class="cx">
</span><span class="cx"> yield inTransaction(
</span><span class="cx"> lambda: self.scheduler.txn.store().newTransaction(
</span><del>- "Submitting iMIP message for UID: %s" % (
</del><ins>+ "Submitting iMIP message for UID: {}".format(
</ins><span class="cx"> self.scheduler.calendar.resourceUID(),)),
</span><span class="cx"> enqueueOp
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> except Exception, e:
</span><span class="cx"> # Generated failed response for this recipient
</span><del>- log.debug("iMIP request %s failed for recipient %s: %s" % (self, recipient, e))
</del><ins>+ log.debug(
+ "iMIP request {req} failed for recipient {r}: {exc}",
+ req=self,
+ r=recipient,
+ exc=e,
+ )
</ins><span class="cx"> failForRecipient(recipient)
</span><span class="cx">
</span><span class="cx"> else:
</span><span class="lines">@@ -127,6 +140,6 @@
</span><span class="cx">
</span><span class="cx"> except Exception, e:
</span><span class="cx"> # Generated failed responses for each recipient
</span><del>- log.debug("iMIP request %s failed: %s" % (self, e))
</del><ins>+ log.debug("iMIP request {req} failed: {exc}", req=self, exc=e)
</ins><span class="cx"> for recipient in self.recipients:
</span><span class="cx"> failForRecipient(recipient)
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimipsmtpsenderpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/smtpsender.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/smtpsender.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/smtpsender.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -40,17 +40,24 @@
</span><span class="cx">
</span><span class="cx"> def sendMessage(self, fromAddr, toAddr, msgId, message):
</span><span class="cx">
</span><del>- log.debug("Sending: %s" % (message,))
</del><ins>+ log.debug("Sending: {msg}", msg=message)
</ins><span class="cx"> def _success(result, msgId, fromAddr, toAddr):
</span><del>- log.info("Sent IMIP message %s from %s to %s" %
- (msgId, fromAddr, toAddr))
</del><ins>+ log.info(
+ "Sent IMIP message {id} from {fr} to {to}",
+ id=msgId,
+ fr=fromAddr,
+ to=toAddr,
+ )
</ins><span class="cx"> return True
</span><span class="cx">
</span><span class="cx"> def _failure(failure, msgId, fromAddr, toAddr):
</span><del>- log.error("Failed to send IMIP message %s from %s "
- "to %s (Reason: %s)" %
- (msgId, fromAddr, toAddr,
- failure.getErrorMessage()))
</del><ins>+ log.error(
+ "Failed to send IMIP message {id} from {fr} to {to} (Reason: {err})",
+ id=msgId,
+ fr=fromAddr,
+ to=toAddr,
+ err=failure.getErrorMessage(),
+ )
</ins><span class="cx"> return False
</span><span class="cx">
</span><span class="cx"> deferred = defer.Deferred()
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduledeliverypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> from txweb2.stream import MemoryStream
</span><span class="cx">
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, DeferredList, returnValue
</span><ins>+from twisted.internet.error import ConnectionDone
</ins><span class="cx"> from twisted.internet.protocol import Factory
</span><span class="cx"> from twisted.python.failure import Failure
</span><span class="cx">
</span><span class="lines">@@ -116,10 +117,10 @@
</span><span class="cx"> cls.domainServerMap[domain] = None
</span><span class="cx"> else:
</span><span class="cx"> # Create the iSchedule server record for this server
</span><del>- cls.domainServerMap[domain] = IScheduleServerRecord(uri="http://%s:%s/.well-known/ischedule" % result)
</del><ins>+ cls.domainServerMap[domain] = IScheduleServerRecord(uri="http://{}:{}/.well-known/ischedule".format(*result))
</ins><span class="cx"> else:
</span><span class="cx"> # Create the iSchedule server record for this server
</span><del>- cls.domainServerMap[domain] = IScheduleServerRecord(uri="https://%s:%s/.well-known/ischedule" % result)
</del><ins>+ cls.domainServerMap[domain] = IScheduleServerRecord(uri="https://{}:{}/.well-known/ischedule".format(*result))
</ins><span class="cx"> else:
</span><span class="cx"> cls.domainServerMap[domain] = None
</span><span class="cx">
</span><span class="lines">@@ -260,11 +261,15 @@
</span><span class="cx"> xml = (yield davXMLFromStream(response.stream))
</span><span class="cx"> self._parseResponse(xml)
</span><span class="cx"> else:
</span><del>- raise ValueError("Incorrect server response status code: %s" % (response.code,))
</del><ins>+ raise ValueError("Incorrect server response status code: {code}".format(code=response.code))
</ins><span class="cx">
</span><span class="cx"> except Exception, e:
</span><span class="cx"> # Generated failed responses for each recipient
</span><del>- log.error("Could not do server-to-server request : %s %s" % (self, e))
</del><ins>+ log.error(
+ "Could not do server-to-server request : {req} {exc}",
+ req=self,
+ exc=e,
+ )
</ins><span class="cx"> for recipient in self.recipients:
</span><span class="cx"> err = HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="lines">@@ -283,17 +288,17 @@
</span><span class="cx"> iostr = StringIO()
</span><span class="cx"> iostr.write(">>>> Request start\n\n")
</span><span class="cx"> if hasattr(request, "clientproto"):
</span><del>- protocol = "HTTP/%d.%d" % (request.clientproto[0], request.clientproto[1],)
</del><ins>+ protocol = "HTTP/{:d}.{:d}".format(request.clientproto[0], request.clientproto[1])
</ins><span class="cx"> else:
</span><span class="cx"> protocol = "HTTP/1.1"
</span><del>- iostr.write("%s %s %s\n" % (request.method, request.uri, protocol,))
</del><ins>+ iostr.write("{} {} {}\n".format(request.method, request.uri, protocol,))
</ins><span class="cx"> for name, valuelist in request.headers.getAllRawHeaders():
</span><span class="cx"> for value in valuelist:
</span><span class="cx"> # Do not log authorization details
</span><span class="cx"> if name not in ("Authorization",):
</span><del>- iostr.write("%s: %s\n" % (name, value))
</del><ins>+ iostr.write("{}: {}\n".format(name, value))
</ins><span class="cx"> else:
</span><del>- iostr.write("%s: xxxxxxxxx\n" % (name,))
</del><ins>+ iostr.write("{}: xxxxxxxxx\n".format(name,))
</ins><span class="cx"> iostr.write("\n")
</span><span class="cx">
</span><span class="cx"> # We need to play a trick with the request stream as we can only read it once. So we
</span><span class="lines">@@ -316,20 +321,23 @@
</span><span class="cx"> iostr = StringIO()
</span><span class="cx"> iostr.write(">>>> Response start\n\n")
</span><span class="cx"> code_message = responsecode.RESPONSES.get(response.code, "Unknown Status")
</span><del>- iostr.write("HTTP/1.1 %s %s\n" % (response.code, code_message,))
</del><ins>+ iostr.write("HTTP/1.1 {} {}\n".format(response.code, code_message,))
</ins><span class="cx"> for name, valuelist in response.headers.getAllRawHeaders():
</span><span class="cx"> for value in valuelist:
</span><span class="cx"> # Do not log authorization details
</span><span class="cx"> if name not in ("WWW-Authenticate",):
</span><del>- iostr.write("%s: %s\n" % (name, value))
</del><ins>+ iostr.write("{}: {}\n".format(name, value))
</ins><span class="cx"> else:
</span><del>- iostr.write("%s: xxxxxxxxx\n" % (name,))
</del><ins>+ iostr.write("{}: xxxxxxxxx\n".format(name,))
</ins><span class="cx"> iostr.write("\n")
</span><span class="cx">
</span><span class="cx"> # We need to play a trick with the response stream to ensure we don't mess it up. So we
</span><span class="cx"> # read it, store the value in a MemoryStream, and replace the response's stream with that,
</span><span class="cx"> # so the data can be read again.
</span><del>- data = (yield allDataFromStream(response.stream))
</del><ins>+ try:
+ data = (yield allDataFromStream(response.stream))
+ except ConnectionDone:
+ data = ""
</ins><span class="cx"> iostr.write(data)
</span><span class="cx"> response.stream = MemoryStream(data if data is not None else "")
</span><span class="cx"> response.stream.doStartReading = None
</span><span class="lines">@@ -358,7 +366,7 @@
</span><span class="cx"> self.sign_headers = []
</span><span class="cx">
</span><span class="cx"> self.headers = Headers()
</span><del>- self.headers.setHeader("Host", utf8String(host + ":%s" % (port,)))
</del><ins>+ self.headers.setHeader("Host", utf8String(host + ":{}".format(port,)))
</ins><span class="cx">
</span><span class="cx"> # The Originator must be the ORGANIZER (for a request) or ATTENDEE (for a reply)
</span><span class="cx"> originator = self.scheduler.organizer.cuaddr if self.scheduler.isiTIPRequest else self.scheduler.attendee
</span><span class="lines">@@ -385,7 +393,7 @@
</span><span class="cx"> ))
</span><span class="cx"> self.sign_headers.append("Content-Type")
</span><span class="cx">
</span><del>- self.headers.setHeader("User-Agent", "CalendarServer/%s" % (version,))
</del><ins>+ self.headers.setHeader("User-Agent", "CalendarServer/{}".format(version,))
</ins><span class="cx"> self.sign_headers.append("User-Agent")
</span><span class="cx">
</span><span class="cx"> # Add any additional headers
</span><span class="lines">@@ -400,7 +408,7 @@
</span><span class="cx"> if self.server.authentication and self.server.authentication[0] == "basic":
</span><span class="cx"> self.headers.setHeader(
</span><span class="cx"> "Authorization",
</span><del>- ('Basic', ("%s:%s" % (self.server.authentication[1], self.server.authentication[2],)).encode('base64')[:-1])
</del><ins>+ ('Basic', ("{}:{}".format(self.server.authentication[1], self.server.authentication[2],)).encode('base64')[:-1])
</ins><span class="cx"> )
</span><span class="cx"> self.sign_headers.append("Authorization")
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduledkimpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/dkim.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/dkim.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/dkim.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -862,7 +862,7 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # First we do an SRV lookup for _domainkey to get the public key server host/port
</span><del>- result = (yield lookupServerViaSRV(self.dkim_tags["d"], service="_domainkey"))
</del><ins>+ result = (yield lookupServerViaSRV(self.dkim_tags["d"], service="_domainkey_lookup"))
</ins><span class="cx"> if result is None:
</span><span class="cx"> log.debug("DKIM: SRV _domainkey failed on: %s trying domain directly" % (self.dkim_tags["d"],))
</span><span class="cx"> host = self.dkim_tags["d"]
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischedulelocalserverspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/localservers.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/localservers.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/localservers.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> self._thisServer = server
</span><span class="cx"> break
</span><span class="cx"> else:
</span><del>- raise ValueError("No server in %s matches this server." % (self._xmlFile,))
</del><ins>+ raise ValueError("No server in {} matches this server.".format(self._xmlFile,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def clear(self):
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx"> try:
</span><span class="cx"> ips = getIPsFromHost(parsed_uri.hostname)
</span><span class="cx"> except socket.gaierror, e:
</span><del>- msg = "Unable to lookup ip-addr for server '%s': %s" % (parsed_uri.hostname, str(e))
</del><ins>+ msg = "Unable to lookup ip-addr for server '{}': {}".format(parsed_uri.hostname, str(e))
</ins><span class="cx"> log.error(msg)
</span><span class="cx"> if ignoreIPLookupFailures:
</span><span class="cx"> ips = ()
</span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx"> try:
</span><span class="cx"> ips = getIPsFromHost(item)
</span><span class="cx"> except socket.gaierror, e:
</span><del>- msg = "Unable to lookup ip-addr for allowed-from '%s': %s" % (item, str(e))
</del><ins>+ msg = "Unable to lookup ip-addr for allowed-from '{}': {}".format(item, str(e))
</ins><span class="cx"> log.error(msg)
</span><span class="cx"> if not ignoreIPLookupFailures:
</span><span class="cx"> raise ValueError(msg)
</span><span class="lines">@@ -214,13 +214,22 @@
</span><span class="cx"> request_secret = headers.getRawHeaders(SERVER_SECRET_HEADER)
</span><span class="cx">
</span><span class="cx"> if request_secret is not None and self.shared_secret is None:
</span><del>- log.error("iSchedule request included unexpected %s header" % (SERVER_SECRET_HEADER,))
</del><ins>+ log.error(
+ "iSchedule request included unexpected {hdr} header",
+ hdr=SERVER_SECRET_HEADER,
+ )
</ins><span class="cx"> return False
</span><span class="cx"> elif request_secret is None and self.shared_secret is not None:
</span><del>- log.error("iSchedule request did not include required %s header" % (SERVER_SECRET_HEADER,))
</del><ins>+ log.error(
+ "iSchedule request did not include required {hdr} header",
+ hdr=SERVER_SECRET_HEADER,
+ )
</ins><span class="cx"> return False
</span><span class="cx"> elif (request_secret[0] if request_secret else None) != self.shared_secret:
</span><del>- log.error("iSchedule request %s header did not match" % (SERVER_SECRET_HEADER,))
</del><ins>+ log.error(
+ "iSchedule request {hdr} header did not match",
+ hdr=SERVER_SECRET_HEADER,
+ )
</ins><span class="cx"> return False
</span><span class="cx"> else:
</span><span class="cx"> return True
</span><span class="lines">@@ -278,12 +287,12 @@
</span><span class="cx"> try:
</span><span class="cx"> _ignore_tree, servers_node = readXML(xmlFile, ELEMENT_SERVERS)
</span><span class="cx"> except ValueError, e:
</span><del>- raise RuntimeError("XML parse error for '%s' because: %s" % (xmlFile, e,))
</del><ins>+ raise RuntimeError("XML parse error for '{}' because: {}".format(xmlFile, e,))
</ins><span class="cx">
</span><span class="cx"> for child in servers_node:
</span><span class="cx">
</span><span class="cx"> if child.tag != ELEMENT_SERVER:
</span><del>- raise RuntimeError("Unknown server type: '%s' in servers file: '%s'" % (child.tag, xmlFile,))
</del><ins>+ raise RuntimeError("Unknown server type: '{}' in servers file: '{}'".format(child.tag, xmlFile,))
</ins><span class="cx">
</span><span class="cx"> server = Server()
</span><span class="cx"> server.isImplicit = child.get(ATTR_IMPLICIT, ATTR_VALUE_YES) == ATTR_VALUE_YES
</span><span class="lines">@@ -298,10 +307,10 @@
</span><span class="cx"> elif node.tag == ELEMENT_SHARED_SECRET:
</span><span class="cx"> server.shared_secret = node.text
</span><span class="cx"> else:
</span><del>- raise RuntimeError("Invalid element '%s' in servers file: '%s'" % (node.tag, xmlFile,))
</del><ins>+ raise RuntimeError("Invalid element '{}' in servers file: '{}'".format(node.tag, xmlFile,))
</ins><span class="cx">
</span><span class="cx"> if server.id is None or server.uri is None:
</span><del>- raise RuntimeError("Invalid server '%s' in servers file: '%s'" % (child.tag, xmlFile,))
</del><ins>+ raise RuntimeError("Invalid server '{}' in servers file: '{}'".format(child.tag, xmlFile,))
</ins><span class="cx">
</span><span class="cx"> server.check(ignoreIPLookupFailures=ignoreIPLookupFailures)
</span><span class="cx"> results[server.id] = server
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduleremoteserverspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> Server-to-server configuration file parser.
</span><span class="cx"> """
</span><span class="cx"> def __repr__(self):
</span><del>- return "<%s %r>" % (self.__class__.__name__, self.xmlFile)
</del><ins>+ return "<{} {}>".format(self.__class__.__name__, self.xmlFile)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __init__(self, xmlFile):
</span><span class="lines">@@ -188,7 +188,7 @@
</span><span class="cx"> elif child.tag == ELEMENT_CLIENT_HOSTS:
</span><span class="cx"> self._parseList(child, ELEMENT_HOST, self.client_hosts)
</span><span class="cx"> else:
</span><del>- raise RuntimeError("[%s] Unknown attribute: %s" % (self.__class__, child.tag,))
</del><ins>+ raise RuntimeError("[{}] Unknown attribute: {}".format(self.__class__, child.tag,))
</ins><span class="cx">
</span><span class="cx"> self._parseDetails()
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduleresourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/resource.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/resource.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/resource.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -111,12 +111,12 @@
</span><span class="cx"> def render(self, request):
</span><span class="cx"> output = """<html>
</span><span class="cx"> <head>
</span><del>-<title>%(rtype)s Inbox Resource</title>
</del><ins>+<title>{rtype} Inbox Resource</title>
</ins><span class="cx"> </head>
</span><span class="cx"> <body>
</span><del>-<h1>%(rtype)s Inbox Resource.</h1>
</del><ins>+<h1>{rtype} Inbox Resource.</h1>
</ins><span class="cx"> </body
</span><del>-</html>""" % {"rtype" : "Podding" if self._podding else "iSchedule", }
</del><ins>+</html>""".format(rtype="Podding" if self._podding else "iSchedule")
</ins><span class="cx">
</span><span class="cx"> response = Response(200, {}, output)
</span><span class="cx"> response.headers.setHeader("content-type", MimeType("text", "html"))
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx"> format = self.determineType(contentType)
</span><span class="cx">
</span><span class="cx"> if format is None:
</span><del>- msg = "MIME type %s not allowed in iSchedule request" % (contentType,)
</del><ins>+ msg = "MIME type {} not allowed in iSchedule request".format(contentType,)
</ins><span class="cx"> self.log.error(msg)
</span><span class="cx"> raise HTTPError(scheduler.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx"> """
</span><span class="cx"> format = None
</span><span class="cx"> if content_type is not None:
</span><del>- format = "%s/%s" % (content_type.mediaType, content_type.mediaSubtype,)
</del><ins>+ format = "{}/{}".format(content_type.mediaType, content_type.mediaSubtype,)
</ins><span class="cx"> return format if format in Component.allowedTypes() else None
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -295,7 +295,10 @@
</span><span class="cx"> # Get list of Recipient headers
</span><span class="cx"> rawRecipients = request.headers.getRawHeaders("recipient")
</span><span class="cx"> if rawRecipients is None or (len(rawRecipients) == 0):
</span><del>- self.log.error("%s request must have at least one Recipient header" % (self.method,))
</del><ins>+ self.log.error(
+ "{method} request must have at least one Recipient header",
+ method=self.method,
+ )
</ins><span class="cx"> raise HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (ischedule_namespace, "recipient-missing"),
</span><span class="lines">@@ -318,7 +321,10 @@
</span><span class="cx"> # Must be content-type text/calendar
</span><span class="cx"> contentType = request.headers.getHeader("content-type")
</span><span class="cx"> if contentType is not None and (contentType.mediaType, contentType.mediaSubtype) != ("text", "calendar"):
</span><del>- self.log.error("MIME type %s not allowed in iSchedule POST request" % (contentType,))
</del><ins>+ self.log.error(
+ "MIME type {ct} not allowed in iSchedule POST request",
+ ct=contentType,
+ )
</ins><span class="cx"> raise HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (ischedule_namespace, "invalid-calendar-data-type"),
</span><span class="lines">@@ -330,7 +336,10 @@
</span><span class="cx"> calendar = (yield Component.fromIStream(request.stream))
</span><span class="cx"> except:
</span><span class="cx"> # FIXME: Bare except
</span><del>- self.log.error("Error while handling iSchedule POST: %s" % (Failure(),))
</del><ins>+ self.log.error(
+ "Error while handling iSchedule POST: {f}",
+ f=Failure(),
+ )
</ins><span class="cx"> raise HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (ischedule_namespace, "invalid-calendar-data"),
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduleschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __repr__(self):
</span><del>- return "<%s %s %s>" % (self.__class__.__name__, self.code, self.error.sname())
</del><ins>+ return "<{} {} {}>".format(self.__class__.__name__, self.code, self.error.sname())
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -171,9 +171,9 @@
</span><span class="cx"> # If DKIM is enabled and there was a DKIM header present, then fail
</span><span class="cx"> msg = "Failed to verify DKIM signature"
</span><span class="cx"> _debug_msg = str(e)
</span><del>- log.debug("%s:%s" % (msg, _debug_msg,))
</del><ins>+ log.debug("{msg}:{exc}", msg=msg, exc=_debug_msg,)
</ins><span class="cx"> if config.Scheduling.iSchedule.DKIM.ProtocolDebug:
</span><del>- msg = "%s:%s" % (msg, _debug_msg,)
</del><ins>+ msg = "{}:{}".format(msg, _debug_msg,)
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (ischedule_namespace, "verification-failed"),
</span><span class="lines">@@ -211,7 +211,10 @@
</span><span class="cx"> def checkAuthorization(self):
</span><span class="cx"> # Must have an unauthenticated user
</span><span class="cx"> if self.originator_uid is not None:
</span><del>- log.error("Authenticated originators not allowed: %s" % (self.originator_uid,))
</del><ins>+ log.error(
+ "Authenticated originators not allowed: {o}",
+ o=self.originator_uid,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -233,7 +236,10 @@
</span><span class="cx">
</span><span class="cx"> # iSchedule must never deliver for users hosted on the server or any pod
</span><span class="cx"> if not self._podding:
</span><del>- log.error("Cannot use originator that is local to this server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Cannot use originator that is local to this server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -242,7 +248,10 @@
</span><span class="cx">
</span><span class="cx"> # Cannot deliver message for someone hosted on the same pod
</span><span class="cx"> elif isinstance(originatorAddress, LocalCalendarUser):
</span><del>- log.error("Cannot use originator that is on this server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Cannot use originator that is on this server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -253,7 +262,10 @@
</span><span class="cx"> self._validAlternateServer(originatorAddress)
</span><span class="cx"> else:
</span><span class="cx"> if self._podding:
</span><del>- log.error("Cannot use originator that is external to this server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Cannot use originator that is external to this server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -277,7 +289,10 @@
</span><span class="cx"> servermgr = IScheduleServers()
</span><span class="cx"> server = servermgr.mapDomain(self.originator.domain)
</span><span class="cx"> if not server or not server.allow_from:
</span><del>- log.error("Originator not on recognized server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Originator not on recognized server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -309,15 +324,26 @@
</span><span class="cx"> matched = True
</span><span class="cx"> break
</span><span class="cx"> except re.error:
</span><del>- log.debug("Invalid regular expression for ServerToServer white list for server domain %s: %s" % (self.originator.domain, pattern,))
</del><ins>+ log.debug(
+ "Invalid regular expression for ServerToServer white list for server domain {domain}: {pat}",
+ dom=self.originator.domain,
+ pat=pattern,
+ )
</ins><span class="cx"> else:
</span><span class="cx"> continue
</span><span class="cx"> break
</span><span class="cx"> except socket.herror, e:
</span><del>- log.debug("iSchedule cannot lookup client ip '%s': %s" % (clientip, str(e),))
</del><ins>+ log.debug(
+ "iSchedule cannot lookup client ip '{ip}': {exc}",
+ ip=clientip,
+ exc=str(e),
+ )
</ins><span class="cx">
</span><span class="cx"> if not matched:
</span><del>- log.error("Originator not on allowed server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Originator not on allowed server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -348,7 +374,10 @@
</span><span class="cx"> elif serversDB.getThisServer().hasAllowedFromIP():
</span><span class="cx"> matched = serversDB.getThisServer().checkAllowedFromIP(clientip)
</span><span class="cx"> if not matched:
</span><del>- log.error("Invalid iSchedule connection from client: %s" % (clientip,))
</del><ins>+ log.error(
+ "Invalid iSchedule connection from client: {o}",
+ o=clientip,
+ )
</ins><span class="cx">
</span><span class="cx"> # Next compare as dotted IP
</span><span class="cx"> elif isIPAddress(expected_uri.hostname):
</span><span class="lines">@@ -363,7 +392,11 @@
</span><span class="cx"> matched = True
</span><span class="cx"> break
</span><span class="cx"> except socket.herror, e:
</span><del>- log.debug("iSchedule cannot lookup client ip '%s': %s" % (clientip, str(e),))
</del><ins>+ log.debug(
+ "iSchedule cannot lookup client ip '{ip}': {exc}",
+ ip=clientip,
+ exc=str(e),
+ )
</ins><span class="cx">
</span><span class="cx"> # Check possible shared secret
</span><span class="cx"> if matched and not serversDB.getThisServer().checkSharedSecret(self.headers):
</span><span class="lines">@@ -371,7 +404,10 @@
</span><span class="cx"> matched = False
</span><span class="cx">
</span><span class="cx"> if not matched:
</span><del>- log.error("Originator not on allowed server: %s" % (self.originator,))
</del><ins>+ log.error(
+ "Originator not on allowed server: {o}",
+ o=self.originator,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["originator-denied"],
</span><span class="lines">@@ -391,7 +427,10 @@
</span><span class="cx"> organizerAddress = yield calendarUserFromCalendarUserAddress(organizer, self.txn)
</span><span class="cx"> if organizerAddress.hosted():
</span><span class="cx"> if isinstance(organizerAddress, LocalCalendarUser):
</span><del>- log.error("Invalid ORGANIZER in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "Invalid ORGANIZER in calendar data: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -404,7 +443,10 @@
</span><span class="cx"> else:
</span><span class="cx"> localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(organizer))
</span><span class="cx"> if localUser:
</span><del>- log.error("Unsupported ORGANIZER in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "Unsupported ORGANIZER in calendar data: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -413,7 +455,10 @@
</span><span class="cx"> else:
</span><span class="cx"> self.organizer = RemoteCalendarUser(organizer)
</span><span class="cx"> else:
</span><del>- log.error("ORGANIZER missing in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "ORGANIZER missing in calendar data: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["organizer-denied"],
</span><span class="lines">@@ -432,7 +477,10 @@
</span><span class="cx"> attendeeAddress = yield calendarUserFromCalendarUserAddress(self.attendee, self.txn)
</span><span class="cx"> if attendeeAddress.hosted():
</span><span class="cx"> if isinstance(attendeeAddress, LocalCalendarUser):
</span><del>- log.error("Invalid ATTENDEE in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "Invalid ATTENDEE in calendar data: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["attendee-denied"],
</span><span class="lines">@@ -443,7 +491,10 @@
</span><span class="cx"> else:
</span><span class="cx"> localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(self.attendee))
</span><span class="cx"> if localUser:
</span><del>- log.error("Unknown ATTENDEE in calendar data: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "Unknown ATTENDEE in calendar data: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["attendee-denied"],
</span><span class="lines">@@ -468,7 +519,10 @@
</span><span class="cx"> yield self.checkAttendeeAsOriginator()
</span><span class="cx">
</span><span class="cx"> else:
</span><del>- log.error("Unknown iTIP METHOD for security checks: %s" % (self.calendar.propertyValue("METHOD"),))
</del><ins>+ log.error(
+ "Unknown iTIP METHOD for security checks: {method}",
+ method=self.calendar.propertyValue("METHOD"),
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduletestdatadbexamplecom"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.example.com (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.example.com        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.example.com        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -15,5 +15,5 @@
</span><span class="cx"> _ischedule._domainkey.example.com.        10800 IN TXT        "v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjUfDqd8ICAL0dyq2KdjKN6LS8O/Y4yMxOxgATqtSIMi7baKXEs1w5Wj9efOC2nU+aqyhP2/J6AzfFJfSB+GV5gcIT+LAC4btJKPGjPUyXcQFJV4a73y0jIgCTBzWxdaP6qD9P9rzYlvMPcdrrKiKoAOtI3JZqAAdZudOmGlc4QQIDAQAB"
</span><span class="cx"> _revoked._domainkey.example.com.        10800 IN TXT        "v=DKIM1; p="
</span><span class="cx">
</span><del>-_domainkey._tcp.example.com.                10800 IN SRV        0        0        8443        key.example.com.
-_domainkey._tcp.www.example.com.        10800 IN SRV        0        0        80                key.example.com.
</del><ins>+_domainkey_lookup._tcp.example.com.                10800 IN SRV        0        0        8443        key.example.com.
+_domainkey_lookup._tcp.www.example.com.        10800 IN SRV        0        0        80                key.example.com.
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischeduleutilspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -58,19 +58,19 @@
</span><span class="cx">
</span><span class="cx"> _initResolver()
</span><span class="cx">
</span><del>- lookup = "%s._tcp.%s" % (service, domain,)
- log.debug("DNS SRV: lookup: %s" % (lookup,))
</del><ins>+ lookup = "{}._tcp.{}".format(service, domain,)
+ log.debug("DNS SRV: lookup: {l}", l=lookup)
</ins><span class="cx"> try:
</span><span class="cx"> answers = (yield DebugResolver.lookupService(lookup))[0]
</span><span class="cx"> except (DomainError, AuthoritativeDomainError), e:
</span><del>- log.debug("DNS SRV: lookup failed: %s" % (e,))
</del><ins>+ log.debug("DNS SRV: lookup failed: {exc}", exc=e)
</ins><span class="cx"> returnValue(None)
</span><span class="cx">
</span><span class="cx"> if len(answers) == 1 and answers[0].type == dns.SRV \
</span><span class="cx"> and answers[0].payload \
</span><span class="cx"> and answers[0].payload.target == dns.Name('.'):
</span><span class="cx"> # decidedly not available
</span><del>- log.debug("DNS SRV: disabled: %s" % (lookup,))
</del><ins>+ log.debug("DNS SRV: disabled: {l}", l=lookup)
</ins><span class="cx"> returnValue(None)
</span><span class="cx">
</span><span class="cx"> servers = []
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">
</span><span class="cx"> servers.append((a.payload.priority, a.payload.weight, str(a.payload.target), a.payload.port))
</span><span class="cx">
</span><del>- log.debug("DNS SRV: lookup results: %s\n%s" % (lookup, servers,))
</del><ins>+ log.debug("DNS SRV: lookup results: {l}\n{s}", l=lookup, s=servers)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def _serverCmp(a, b):
</span><span class="lines">@@ -104,10 +104,10 @@
</span><span class="cx"> host = host.rstrip(".")
</span><span class="cx"> break
</span><span class="cx"> else:
</span><del>- log.debug("DNS SRV: unable to determine best record to use: %s" % (lookup,))
</del><ins>+ log.debug("DNS SRV: unable to determine best record to use: {l}", l=lookup)
</ins><span class="cx"> returnValue(None)
</span><span class="cx">
</span><del>- log.debug("DNS SRV: lookup chosen service: %s %s %s" % (lookup, host, port,))
</del><ins>+ log.debug("DNS SRV: lookup chosen service: {l} {h} {p}", l=lookup, h=host, p=port)
</ins><span class="cx"> returnValue((host, port,))
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -117,12 +117,12 @@
</span><span class="cx">
</span><span class="cx"> _initResolver()
</span><span class="cx">
</span><del>- lookup = "%s.%s" % (prefix, domain,) if prefix else domain
- log.debug("DNS TXT: lookup: %s" % (lookup,))
</del><ins>+ lookup = "{}.{}".format(prefix, domain,) if prefix else domain
+ log.debug("DNS TXT: lookup: {l}", l=lookup)
</ins><span class="cx"> try:
</span><span class="cx"> answers = (yield DebugResolver.lookupText(lookup))[0]
</span><span class="cx"> except (DomainError, AuthoritativeDomainError), e:
</span><del>- log.debug("DNS TXT: lookup failed: %s" % (e,))
</del><ins>+ log.debug("DNS TXT: lookup failed: {exc}", exc=e)
</ins><span class="cx"> answers = ()
</span><span class="cx">
</span><span class="cx"> results = []
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">
</span><span class="cx"> results.append("".join(a.payload.data))
</span><span class="cx">
</span><del>- log.debug("DNS TXT: lookup results: %s\n%s" % (lookup, "\n".join(results),))
</del><ins>+ log.debug("DNS TXT: lookup results: {l}\n{r}", l=lookup, r="\n".join(results))
</ins><span class="cx"> returnValue(results)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -142,9 +142,20 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _lookup(self, name, cls, type, timeout=None):
</span><del>- log.debug("DNS FakeBindAuthority: lookup: %s %s %s" % (name, cls, type,))
</del><ins>+ log.debug(
+ "DNS FakeBindAuthority: lookup: {name} {cls} {type}",
+ name=name,
+ cls=cls,
+ type=type,
+ )
</ins><span class="cx"> result = yield BindAuthority._lookup(self, name, cls, type, timeout)
</span><del>- log.debug("DNS FakeBindAuthority: lookup results: %s %s %s\n%s" % (name, cls, type, result[0]))
</del><ins>+ log.debug(
+ "DNS FakeBindAuthority: lookup results: {name} {cls} {type}\n{r}",
+ name=name,
+ cls=cls,
+ type=type,
+ r=result[0],
+ )
</ins><span class="cx"> returnValue(result)
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingischedulexmlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/xml.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/xml.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/xml.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -269,10 +269,10 @@
</span><span class="cx"> raise ValueError("Missing calendar data")
</span><span class="cx"> return clazz(PCDATAElement(calendar))
</span><span class="cx"> elif isinstance(calendar, iComponent):
</span><del>- assert calendar.name() == "VCALENDAR", "Not a calendar: %r" % (calendar,)
</del><ins>+ assert calendar.name() == "VCALENDAR", "Not a calendar: {}".format(calendar)
</ins><span class="cx"> return clazz(PCDATAElement(calendar.getTextWithTimezones(includeTimezones=not config.EnableTimezonesByReference, format=format)))
</span><span class="cx"> else:
</span><del>- raise ValueError("Not a calendar: %s" % (calendar,))
</del><ins>+ raise ValueError("Not a calendar: {}".format(calendar))
</ins><span class="cx">
</span><span class="cx"> fromTextData = fromCalendar
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingschedulerpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py (13516 => 13517)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py        2014-05-20 18:49:22 UTC (rev 13516)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py        2014-05-20 18:50:48 UTC (rev 13517)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> # of data for all events with the same UID. So detect this and use a lock
</span><span class="cx"> if calendar.resourceType() != "VFREEBUSY":
</span><span class="cx"> uid = calendar.resourceUID()
</span><del>- yield NamedLock.acquire(self.txn, "ImplicitUIDLock:%s" % (hashlib.md5(uid).hexdigest(),))
</del><ins>+ yield NamedLock.acquire(self.txn, "ImplicitUIDLock:{}".format(hashlib.md5(uid).hexdigest(),))
</ins><span class="cx">
</span><span class="cx"> result = (yield self.doSchedulingDirectly("POST", originator, recipients, calendar))
</span><span class="cx"> returnValue(result)
</span><span class="lines">@@ -276,7 +276,12 @@
</span><span class="cx"> try:
</span><span class="cx"> self.calendar.validCalendarData()
</span><span class="cx"> except ValueError, e:
</span><del>- log.error("%s request calendar component is not valid:%s %s" % (self.method, e, self.calendar,))
</del><ins>+ log.error(
+ "{method} request calendar component is not valid:{exc} {cal}",
+ method=self.method,
+ exc=e,
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-calendar-data"],
</span><span class="lines">@@ -285,7 +290,11 @@
</span><span class="cx">
</span><span class="cx"> # Must have a METHOD
</span><span class="cx"> if not self.calendar.isValidMethod():
</span><del>- log.error("%s request must have valid METHOD property in calendar component: %s" % (self.method, self.calendar,))
</del><ins>+ log.error(
+ "{method} request must have valid METHOD property in calendar component: {cal}",
+ method=self.method,
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -294,7 +303,11 @@
</span><span class="cx">
</span><span class="cx"> # Verify iTIP behavior
</span><span class="cx"> if not self.calendar.isValidITIP():
</span><del>- log.error("%s request must have a calendar component that satisfies iTIP requirements: %s" % (self.method, self.calendar,))
</del><ins>+ log.error(
+ "{method} request must have a calendar component that satisfies iTIP requirements: {cal}",
+ method=self.method,
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -303,7 +316,11 @@
</span><span class="cx">
</span><span class="cx"> # X-CALENDARSERVER-ACCESS is not allowed in Outbox POSTs
</span><span class="cx"> if self.calendar.hasProperty(Component.ACCESS_PROPERTY):
</span><del>- log.error("X-CALENDARSERVER-ACCESS not allowed in a calendar component %s request: %s" % (self.method, self.calendar,))
</del><ins>+ log.error(
+ "X-CALENDARSERVER-ACCESS not allowed in a calendar component {method} request: {cal}",
+ method=self.method,
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (calendarserver_namespace, "no-access-restrictions"),
</span><span class="lines">@@ -322,7 +339,10 @@
</span><span class="cx">
</span><span class="cx"> # Must have only one
</span><span class="cx"> if len(attendees) != 1:
</span><del>- log.error("Wrong number of ATTENDEEs in calendar data: %s" % (str(self.calendar),))
</del><ins>+ log.error(
+ "Wrong number of ATTENDEEs in calendar data: {cal}",
+ cal=str(self.calendar),
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -331,7 +351,7 @@
</span><span class="cx"> self.attendee = attendees[0]
</span><span class="cx">
</span><span class="cx"> else:
</span><del>- msg = "Unknown iTIP METHOD: %s" % (self.calendar.propertyValue("METHOD"),)
</del><ins>+ msg = "Unknown iTIP METHOD: {}".format(self.calendar.propertyValue("METHOD"),)
</ins><span class="cx"> log.error(msg)
</span><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="lines">@@ -346,7 +366,10 @@
</span><span class="cx"> # Extract time range from VFREEBUSY object
</span><span class="cx"> vfreebusies = [v for v in self.calendar.subcomponents() if v.name() == "VFREEBUSY"]
</span><span class="cx"> if len(vfreebusies) != 1:
</span><del>- log.error("iTIP data is not valid for a VFREEBUSY request: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "iTIP data is not valid for a VFREEBUSY request: {cal}",
+ cal=str(self.calendar),
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -355,7 +378,10 @@
</span><span class="cx"> dtstart = vfreebusies[0].getStartDateUTC()
</span><span class="cx"> dtend = vfreebusies[0].getEndDateUTC()
</span><span class="cx"> if dtstart is None or dtend is None:
</span><del>- log.error("VFREEBUSY start/end not valid: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "VFREEBUSY start/end not valid: {cal}",
+ cal=str(self.calendar),
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -364,7 +390,10 @@
</span><span class="cx">
</span><span class="cx"> # Some clients send floating instead of UTC - coerce to UTC
</span><span class="cx"> if not dtstart.utc() or not dtend.utc():
</span><del>- log.error("VFREEBUSY start or end not UTC: %s" % (self.calendar,))
</del><ins>+ log.error(
+ "VFREEBUSY start or end not UTC: {cal}",
+ cal=self.calendar,
+ )
</ins><span class="cx"> raise HTTPError(self.errorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> self.errorElements["invalid-scheduling-message"],
</span><span class="lines">@@ -406,12 +435,11 @@
</span><span class="cx"> emitAccounting(
</span><span class="cx"> accountingType,
</span><span class="cx"> self.organizer.record,
</span><del>- "Originator: %s\nRecipients:\n%sMethod:%s\n\n%s"
- % (
- str(self.originator),
- str("".join([" %s\n" % (recipient,) for recipient in self.recipients])),
- str(self.method),
- str(self.calendar),
</del><ins>+ "Originator: {o}\nRecipients:\n{r}Method:{method}\n\n{cal}".format(
+ o=str(self.originator),
+ r=str("".join([" {}\n".format(recipient,) for recipient in self.recipients])),
+ method=str(self.method),
+ cal=str(self.calendar),
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -426,7 +454,11 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def generateSchedulingResponse(self):
</span><span class="cx">
</span><del>- log.info("METHOD: %s, Component: %s" % (self.calendar.propertyValue("METHOD"), self.calendar.mainType(),))
</del><ins>+ log.info(
+ "METHOD: {method}, Component: {comp}",
+ method=self.calendar.propertyValue("METHOD"),
+ comp=self.calendar.mainType(),
+ )
</ins><span class="cx">
</span><span class="cx"> # For free-busy do immediate determination of iTIP result rather than fan-out
</span><span class="cx"> freebusy = self.checkForFreeBusy()
</span><span class="lines">@@ -559,9 +591,15 @@
</span><span class="cx"> if not recipientAddress.hosted():
</span><span class="cx"> localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(recipient))
</span><span class="cx"> if localUser:
</span><del>- log.error("No record for calendar user address: %s" % (recipient,))
</del><ins>+ log.error(
+ "No record for calendar user address: {r}",
+ r=recipient,
+ )
</ins><span class="cx"> else:
</span><del>- log.error("Unknown calendar user address: %s" % (recipient,))
</del><ins>+ log.error(
+ "Unknown calendar user address: {r}",
+ r=recipient,
+ )
</ins><span class="cx"> results.append(InvalidCalendarUser(recipient))
</span><span class="cx"> else:
</span><span class="cx"> # Map recipient to their inbox and cache on calendar user object
</span><span class="lines">@@ -578,7 +616,10 @@
</span><span class="cx"> if inbox:
</span><span class="cx"> results.append(recipientAddress)
</span><span class="cx"> else:
</span><del>- log.error("No scheduling for calendar user: %s" % (recipient,))
</del><ins>+ log.error(
+ "No scheduling for calendar user: {r}",
+ r=recipient,
+ )
</ins><span class="cx"> results.append(InvalidCalendarUser(recipient))
</span><span class="cx">
</span><span class="cx"> self.recipients = results
</span><span class="lines">@@ -704,13 +745,17 @@
</span><span class="cx"> error = self.errorForFailure(what)
</span><span class="cx"> message = messageForFailure(what)
</span><span class="cx"> else:
</span><del>- raise AssertionError("Unknown data type: %r" % (what,))
</del><ins>+ raise AssertionError("Unknown data type: {}".format(what,))
</ins><span class="cx">
</span><span class="cx"> if self.recipient_mapper is not None:
</span><span class="cx"> recipient = self.recipient_mapper(recipient)
</span><span class="cx">
</span><span class="cx"> if not suppressErrorLog and code > 400: # Error codes only
</span><del>- self.log.error("Error during %s for %s: %s" % (self.method, recipient, message))
</del><ins>+ self.log.error("Error during {method} for {r}: {msg}",
+ method=self.method,
+ r=recipient,
+ msg=message,
+ )
</ins><span class="cx">
</span><span class="cx"> details = ScheduleResponseQueue.ScheduleResonseDetails(
</span><span class="cx"> self.recipient_element(davxml.HRef.fromString(recipient)) if self.recipient_uses_href else self.recipient_element.fromString(recipient),
</span></span></pre>
</div>
</div>
</body>
</html>