<!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>[13216] CalendarServer/trunk/txdav/xml</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/13216">13216</a></dd>
<dt>Author</dt> <dd>gaya@apple.com</dd>
<dt>Date</dt> <dd>2014-04-08 22:14:38 -0700 (Tue, 08 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use format() instead of %</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxdavxmlrfc2518py">CalendarServer/trunk/txdav/xml/rfc2518.py</a></li>
<li><a href="#CalendarServertrunktxdavxmlrfc3744py">CalendarServer/trunk/txdav/xml/rfc3744.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxdavxmlrfc2518py"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/xml/rfc2518.py (13215 => 13216)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/xml/rfc2518.py        2014-04-09 04:19:17 UTC (rev 13215)
+++ CalendarServer/trunk/txdav/xml/rfc2518.py        2014-04-09 05:14:38 UTC (rev 13216)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">
</span><span class="cx"> depth = str(self)
</span><span class="cx"> if depth not in ("0", "1", "infinity"):
</span><del>- raise ValueError("Invalid depth: %s" % (depth,))
</del><ins>+ raise ValueError("Invalid depth: {0}".format(depth,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -307,22 +307,35 @@
</span><span class="cx"> propstat_count += 1
</span><span class="cx">
</span><span class="cx"> if resource_count < 1:
</span><del>- raise ValueError("%s element must have at least one %s."
- % (cls.sname(), HRef.sname()))
</del><ins>+ raise ValueError(
+ "{0} element must have at least one {1}.".format(
+ cls.sname(), HRef.sname()
+ )
+ )
</ins><span class="cx">
</span><span class="cx"> if status_count is 0:
</span><span class="cx"> if propstat_count is 0:
</span><del>- raise ValueError("%s element must have one of %s or %s"
- % (cls.sname(), Status.sname(), PropertyStatus.sname()))
</del><ins>+ raise ValueError(
+ "{0} element must have one of {1} or {2}".format(
+ cls.sname(), Status.sname(), PropertyStatus.sname()
+ )
+ )
</ins><span class="cx">
</span><span class="cx"> if resource_count > 1:
</span><del>- raise ValueError("%s element with %s may only have one %s"
- % (cls.sname(), PropertyStatus.sname(), HRef.sname()))
</del><ins>+ raise ValueError(
+ "{0} element with {1} may only have one {2}".format(
+ cls.sname(), PropertyStatus.sname(), HRef.sname()
+ )
+ )
</ins><span class="cx">
</span><span class="cx"> return PropertyStatusResponse.__new__(PropertyStatusResponse, *children)
</span><span class="cx">
</span><span class="cx"> if status_count > 1:
</span><del>- raise ValueError("%s element may only have one %s" % (cls.sname(), Status.sname()))
</del><ins>+ raise ValueError(
+ "{0} element may only have one {1}".format(
+ cls.sname(), Status.sname()
+ )
+ )
</ins><span class="cx">
</span><span class="cx"> return StatusResponse.__new__(StatusResponse, *children)
</span><span class="cx">
</span><span class="lines">@@ -393,9 +406,9 @@
</span><span class="cx"> txweb2.responsecode.RESPONSES.keys()
</span><span class="cx"> """
</span><span class="cx"> if code not in responsecode.RESPONSES:
</span><del>- raise ValueError("Invalid response code: %r" % (code,))
</del><ins>+ raise ValueError("Invalid response code: {0!r}".format(code,))
</ins><span class="cx">
</span><del>- return cls(PCDATAElement("HTTP/1.1 %d %s" % (code, responsecode.RESPONSES[code])))
</del><ins>+ return cls(PCDATAElement("HTTP/1.1 {0} {1}".format(code, responsecode.RESPONSES[code])))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def __init__(self, *children, **attributes):
</span><span class="lines">@@ -403,11 +416,11 @@
</span><span class="cx">
</span><span class="cx"> status = str(self)
</span><span class="cx"> if not status.startswith("HTTP/1.1 "):
</span><del>- raise ValueError("Invalid WebDAV status: %s" % (status,))
</del><ins>+ raise ValueError("Invalid WebDAV status: {0}".format(status,))
</ins><span class="cx">
</span><span class="cx"> code = int(status[9:12])
</span><span class="cx"> if code not in responsecode.RESPONSES:
</span><del>- raise ValueError("Invalid status code: %s" % (code,))
</del><ins>+ raise ValueError("Invalid status code: {0}".format(code,))
</ins><span class="cx">
</span><span class="cx"> self.code = code
</span><span class="cx">
</span><span class="lines">@@ -475,8 +488,9 @@
</span><span class="cx">
</span><span class="cx"> if len(self.children) != 1:
</span><span class="cx"> raise ValueError(
</span><del>- "Exactly one of DAV:omit, DAV:keepalive required for %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Exactly one of DAV:omit, DAV:keepalive required for {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> self.behavior = children[0]
</span><span class="lines">@@ -508,13 +522,14 @@
</span><span class="cx"> type = child.qname()
</span><span class="cx"> elif child.qname() != type:
</span><span class="cx"> raise ValueError(
</span><del>- "Only one of DAV:href or PCDATA allowed for %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Only one of DAV:href or PCDATA allowed for {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> if type == "#PCDATA":
</span><span class="cx"> if str(self) != "*":
</span><del>- raise ValueError("Invalid keepalive value: %r", (str(self),))
</del><ins>+ raise ValueError("Invalid keepalive value: {0!r}".format(str(self),))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -592,8 +607,9 @@
</span><span class="cx">
</span><span class="cx"> if len(self.children) != 1:
</span><span class="cx"> raise ValueError(
</span><del>- "Exactly one of DAV:allprop, DAV:propname or DAV:prop is required for %s, got: %r"
- % (self.sname(), self.children)
</del><ins>+ "Exactly one of DAV:allprop, DAV:propname or DAV:prop is required for {0}, got: {1!r}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavxmlrfc3744py"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/xml/rfc3744.py (13215 => 13216)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/xml/rfc3744.py        2014-04-09 04:19:17 UTC (rev 13215)
+++ CalendarServer/trunk/txdav/xml/rfc3744.py        2014-04-09 05:14:38 UTC (rev 13216)
</span><span class="lines">@@ -187,8 +187,9 @@
</span><span class="cx"> raise ValueError(
</span><span class="cx"> "Exactly one of DAV:href, DAV:all, DAV:authenticated, "
</span><span class="cx"> "DAV:unauthenticated, DAV:property or DAV:self is required for "
</span><del>- "%s, got: %r"
- % (self.sname(), self.children)
</del><ins>+ "{0}, got: {1!r}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -504,8 +505,9 @@
</span><span class="cx"> if name in ("principal", "invert"):
</span><span class="cx"> if self.principal is not None:
</span><span class="cx"> raise ValueError(
</span><del>- "Only one of DAV:principal or DAV:invert allowed in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Only one of DAV:principal or DAV:invert allowed in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> if name == "invert":
</span><span class="cx"> self.invert = True
</span><span class="lines">@@ -517,8 +519,9 @@
</span><span class="cx"> elif name in ("grant", "deny"):
</span><span class="cx"> if self.allow is not None:
</span><span class="cx"> raise ValueError(
</span><del>- "Only one of DAV:grant or DAV:deny allowed in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Only one of DAV:grant or DAV:deny allowed in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> self.allow = (name == "grant")
</span><span class="cx"> self.privileges = child.children
</span><span class="lines">@@ -535,15 +538,17 @@
</span><span class="cx">
</span><span class="cx"> if self.principal is None:
</span><span class="cx"> raise ValueError(
</span><del>- "One of DAV:principal or DAV:invert is required in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "One of DAV:principal or DAV:invert is required in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> assert self.invert is not None
</span><span class="cx">
</span><span class="cx"> if self.allow is None:
</span><span class="cx"> raise ValueError(
</span><del>- "One of DAV:grant or DAV:deny is required in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "One of DAV:grant or DAV:deny is required in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> assert self.privileges is not None
</span><span class="cx">
</span><span class="lines">@@ -740,8 +745,9 @@
</span><span class="cx"> elif child.qname() != type:
</span><span class="cx"> raise ValueError(
</span><span class="cx"> "Only one of DAV:all, DAV:authenticated, DAV:unauthenticated, "
</span><del>- "DAV:self, DAV:href or DAV:property allowed for %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "DAV:self, DAV:href or DAV:property allowed for {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -835,8 +841,9 @@
</span><span class="cx"> if child.qname() == (dav_namespace, "prop"):
</span><span class="cx"> if prop:
</span><span class="cx"> raise ValueError(
</span><del>- "Only one DAV:prop allowed for %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Only one DAV:prop allowed for {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> prop = True
</span><span class="cx">
</span><span class="lines">@@ -873,15 +880,17 @@
</span><span class="cx"> if (namespace == dav_namespace) and name in ("principal-property", "self"):
</span><span class="cx"> if principalPropertyOrSelf:
</span><span class="cx"> raise ValueError(
</span><del>- "Only one of DAV:principal-property or DAV:self allowed in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "Only one of DAV:principal-property or DAV:self allowed in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx"> principalPropertyOrSelf = True
</span><span class="cx">
</span><span class="cx"> if not principalPropertyOrSelf:
</span><span class="cx"> raise ValueError(
</span><del>- "One of DAV:principal-property or DAV:self is required in %s, got: %s"
- % (self.sname(), self.children)
</del><ins>+ "One of DAV:principal-property or DAV:self is required in {0}, got: {1}".format(
+ self.sname(), self.children
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>