<!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>[9472] CalendarServer/trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/calendarserver/changeset/9472">9472</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2012-07-20 15:46:08 -0700 (Fri, 20 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use encodeXMLName()</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktwextweb2davmethodreportpy">CalendarServer/trunk/twext/web2/dav/method/report.py</a></li>
<li><a href="#CalendarServertrunktwextweb2davnonepropspy">CalendarServer/trunk/twext/web2/dav/noneprops.py</a></li>
<li><a href="#CalendarServertrunktwextweb2davresourcepy">CalendarServer/trunk/twext/web2/dav/resource.py</a></li>
<li><a href="#CalendarServertrunktwextweb2davtesttest_xattrpropspy">CalendarServer/trunk/twext/web2/dav/test/test_xattrprops.py</a></li>
<li><a href="#CalendarServertrunktwextweb2davtestutilpy">CalendarServer/trunk/twext/web2/dav/test/util.py</a></li>
<li><a href="#CalendarServertrunktwextweb2davxattrpropspy">CalendarServer/trunk/twext/web2/dav/xattrprops.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavextensionspy">CalendarServer/trunk/twistedcaldav/extensions.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavmemcachepropspy">CalendarServer/trunk/twistedcaldav/memcacheprops.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavmethodreportpy">CalendarServer/trunk/twistedcaldav/method/report.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavstorebridgepy">CalendarServer/trunk/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavtesttest_memcachepropspy">CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavtesttest_validationpy">CalendarServer/trunk/twistedcaldav/test/test_validation.py</a></li>
<li><a href="#CalendarServertrunktxdavbasepropertystorebasepy">CalendarServer/trunk/txdav/base/propertystore/base.py</a></li>
<li><a href="#CalendarServertrunktxdavbasepropertystorexattrpy">CalendarServer/trunk/txdav/base/propertystore/xattr.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktwextweb2davmethodreportpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/method/report.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/method/report.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/method/report.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> from twext.web2.dav.util import davXMLFromStream
</span><span class="cx"> from txdav.xml import element as davxml
</span><span class="cx"> from txdav.xml.element import lookupElement
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> 
</span><span class="cx"> log = Logger()
</span><span class="cx"> 
</span><span class="lines">@@ -115,7 +116,7 @@
</span><span class="cx">         if namespace == davxml.dav_namespace:
</span><span class="cx">             request.submethod = &quot;DAV:&quot; + name
</span><span class="cx">         else:
</span><del>-            request.submethod = &quot;{%s}%s&quot; % (namespace, name)
</del><ins>+            request.submethod = encodeXMLName(namespace, name)
</ins><span class="cx">     else:
</span><span class="cx">         method_name = to_method(name)
</span><span class="cx"> 
</span><span class="lines">@@ -136,8 +137,8 @@
</span><span class="cx">         #
</span><span class="cx">         # Requested report is not supported.
</span><span class="cx">         #
</span><del>-        log.err(&quot;Unsupported REPORT {%s}%s for resource %s (no method %s)&quot;
-                % (namespace, name, self, method_name))
</del><ins>+        log.err(&quot;Unsupported REPORT %s for resource %s (no method %s)&quot;
+                % (encodeXMLName(namespace, name), self, method_name))
</ins><span class="cx"> 
</span><span class="cx">         raise HTTPError(ErrorResponse(
</span><span class="cx">             responsecode.FORBIDDEN,
</span></span></pre></div>
<a id="CalendarServertrunktwextweb2davnonepropspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/noneprops.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/noneprops.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/noneprops.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -33,7 +33,9 @@
</span><span class="cx"> 
</span><span class="cx"> from twext.web2 import responsecode
</span><span class="cx"> from twext.web2.http import HTTPError, StatusResponse
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class NonePropertyStore (object):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     DAV property store which contains no properties and does not allow
</span><span class="lines">@@ -50,10 +52,16 @@
</span><span class="cx">         pass
</span><span class="cx"> 
</span><span class="cx">     def get(self, qname, uid=None):
</span><del>-        raise HTTPError(StatusResponse(responsecode.NOT_FOUND, &quot;No such property: {%s}%s&quot; % qname))
</del><ins>+        raise HTTPError(StatusResponse(
+            responsecode.NOT_FOUND,
+            &quot;No such property: %s&quot; % (encodeXMLName(*qname),)
+        ))
</ins><span class="cx"> 
</span><span class="cx">     def set(self, property, uid=None):
</span><del>-        raise HTTPError(StatusResponse(responsecode.FORBIDDEN, &quot;Permission denied for setting property: %s&quot; % (property,)))
</del><ins>+        raise HTTPError(StatusResponse(
+            responsecode.FORBIDDEN,
+            &quot;Permission denied for setting property: %s&quot; % (property,)
+        ))
</ins><span class="cx"> 
</span><span class="cx">     def delete(self, qname, uid=None):
</span><span class="cx">         # RFC 2518 Section 12.13.1 says that removal of
</span></span></pre></div>
<a id="CalendarServertrunktwextweb2davresourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/resource.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/resource.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/resource.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -57,6 +57,12 @@
</span><span class="cx"> from twisted.internet import reactor
</span><span class="cx"> 
</span><span class="cx"> from twext.python.log import Logger
</span><ins>+from txdav.xml import element
+from txdav.xml.base import encodeXMLName
+from txdav.xml.element import WebDAVElement, WebDAVEmptyElement, WebDAVTextElement
+from txdav.xml.element import dav_namespace
+from txdav.xml.element import twisted_dav_namespace, twisted_private_namespace
+from txdav.xml.element import registerElement, lookupElement
</ins><span class="cx"> from twext.web2 import responsecode
</span><span class="cx"> from twext.web2.http import HTTPError, RedirectResponse, StatusResponse
</span><span class="cx"> from twext.web2.http_headers import generateContentType
</span><span class="lines">@@ -70,11 +76,6 @@
</span><span class="cx"> from twext.web2.dav.noneprops import NonePropertyStore
</span><span class="cx"> from twext.web2.dav.util import unimplemented, parentForURL, joinURL
</span><span class="cx"> from twext.web2.dav.auth import PrincipalCredentials
</span><del>-from txdav.xml import element
-from txdav.xml.element import WebDAVElement, WebDAVEmptyElement, WebDAVTextElement
-from txdav.xml.element import dav_namespace
-from txdav.xml.element import twisted_dav_namespace, twisted_private_namespace
-from txdav.xml.element import registerElement, lookupElement
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> log = Logger()
</span><span class="lines">@@ -217,7 +218,7 @@
</span><span class="cx">         def defer():
</span><span class="cx">             if type(property) is tuple:
</span><span class="cx">                 qname = property
</span><del>-                sname = &quot;{%s}%s&quot; % property
</del><ins>+                sname = encodeXMLName(*property)
</ins><span class="cx">             else:
</span><span class="cx">                 qname = property.qname()
</span><span class="cx">                 sname = property.sname()
</span><span class="lines">@@ -416,7 +417,7 @@
</span><span class="cx">         def defer():
</span><span class="cx">             if type(property) is tuple:
</span><span class="cx">                 qname = property
</span><del>-                sname = &quot;{%s}%s&quot; % property
</del><ins>+                sname = encodeXMLName(*property)
</ins><span class="cx">             else:
</span><span class="cx">                 qname = property.qname()
</span><span class="cx">                 sname = property.sname()
</span><span class="lines">@@ -1873,9 +1874,9 @@
</span><span class="cx">                     return None
</span><span class="cx"> 
</span><span class="cx">                 if not isinstance(principal, element.Principal):
</span><del>-                    log.err(&quot;Non-principal value in property {%s}%s &quot;
</del><ins>+                    log.err(&quot;Non-principal value in property %s &quot;
</ins><span class="cx">                             &quot;referenced by property principal.&quot;
</span><del>-                            % (namespace, name))
</del><ins>+                            % (encodeXMLName(namespace, name),))
</ins><span class="cx">                     return None
</span><span class="cx"> 
</span><span class="cx">                 if len(principal.children) != 1:
</span></span></pre></div>
<a id="CalendarServertrunktwextweb2davtesttest_xattrpropspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/test/test_xattrprops.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/test/test_xattrprops.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/test/test_xattrprops.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">         attribute = (
</span><span class="cx">             self.propertyStore.deadPropertyXattrPrefix +
</span><span class="cx">             (uid if uid is not None else &quot;&quot;) +
</span><del>-            &quot;{%s}%s&quot; % element.qname())
</del><ins>+            element.sname())
</ins><span class="cx">         self.attrs[attribute] = value
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">         attribute = (
</span><span class="cx">             self.propertyStore.deadPropertyXattrPrefix +
</span><span class="cx">             (uid if uid is not None else &quot;&quot;) +
</span><del>-            &quot;{%s}%s&quot; % element.qname())
</del><ins>+            element.sname())
</ins><span class="cx">         return self.attrs[attribute]
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktwextweb2davtestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/test/util.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/test/util.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/test/util.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> from twext.web2.dav.static import DAVFile
</span><span class="cx"> from twext.web2.dav.util import joinURL
</span><span class="cx"> from txdav.xml import element
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> 
</span><span class="cx"> log = Logger()
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx">         except KeyError:
</span><span class="cx">             raise HTTPError(StatusResponse(
</span><span class="cx">                 responsecode.NOT_FOUND,
</span><del>-                &quot;No such property: {%s}%s&quot; % qname
</del><ins>+                &quot;No such property: %s&quot; % (encodeXMLName(*qname),)
</ins><span class="cx">             ))
</span><span class="cx"> 
</span><span class="cx">         doc = element.WebDAVDocument.fromString(property)
</span></span></pre></div>
<a id="CalendarServertrunktwextweb2davxattrpropspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/web2/dav/xattrprops.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/web2/dav/xattrprops.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twext/web2/dav/xattrprops.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -50,10 +50,11 @@
</span><span class="cx"> from twisted.python.util import untilConcludes
</span><span class="cx"> from twisted.python.failure import Failure
</span><span class="cx"> from twisted.python.log import err
</span><ins>+from txdav.xml.base import encodeXMLName
+from txdav.xml.parser import WebDAVDocument
</ins><span class="cx"> from twext.web2 import responsecode
</span><span class="cx"> from twext.web2.http import HTTPError, StatusResponse
</span><span class="cx"> from twext.web2.dav.http import statusForFailure
</span><del>-from txdav.xml.parser import WebDAVDocument
</del><span class="cx"> 
</span><span class="cx"> # RFC 2518 Section 12.13.1 says that removal of non-existing property
</span><span class="cx"> # is not an error.  python-xattr on Linux fails with ENODATA in this
</span><span class="lines">@@ -86,7 +87,7 @@
</span><span class="cx">         deadPropertyXattrPrefix = &quot;user.&quot;
</span><span class="cx"> 
</span><span class="cx">     def _encode(clazz, name, uid=None):
</span><del>-        result = urllib.quote(&quot;{%s}%s&quot; % name, safe='{}:')
</del><ins>+        result = urllib.quote(encodeXMLName(*name), safe='{}:')
</ins><span class="cx">         if uid:
</span><span class="cx">             result = uid + result
</span><span class="cx">         r = clazz.deadPropertyXattrPrefix + result
</span><span class="lines">@@ -138,17 +139,20 @@
</span><span class="cx">             data = self.attrs.get(self._encode(qname, uid))
</span><span class="cx">         except KeyError:
</span><span class="cx">             raise HTTPError(StatusResponse(
</span><del>-                    responsecode.NOT_FOUND,
-                    &quot;No such property: {%s}%s&quot; % qname))
</del><ins>+                responsecode.NOT_FOUND,
+                &quot;No such property: %s&quot; % (encodeXMLName(*qname),)
+            ))
</ins><span class="cx">         except IOError, e:
</span><span class="cx">             if e.errno in _ATTR_MISSING or e.errno == errno.ENOENT:
</span><span class="cx">                 raise HTTPError(StatusResponse(
</span><del>-                        responsecode.NOT_FOUND,
-                        &quot;No such property: {%s}%s&quot; % qname))
</del><ins>+                    responsecode.NOT_FOUND,
+                    &quot;No such property: %s&quot; % (encodeXMLName(*qname),)
+                ))
</ins><span class="cx">             else:
</span><span class="cx">                 raise HTTPError(StatusResponse(
</span><del>-                        statusForFailure(Failure()),
-                        &quot;Unable to read property: {%s}%s&quot; % qname))
</del><ins>+                    statusForFailure(Failure()),
+                    &quot;Unable to read property: %s&quot; % (encodeXMLName(*qname),)
+                ))
</ins><span class="cx"> 
</span><span class="cx">         #
</span><span class="cx">         # Unserialize XML data from an xattr.  The storage format has changed
</span><span class="lines">@@ -175,8 +179,8 @@
</span><span class="cx">             try:
</span><span class="cx">                 doc = unpickle(data)
</span><span class="cx">             except UnpicklingError:
</span><del>-                format = &quot;Invalid property value stored on server: {%s}%s %s&quot;
-                msg = format % (qname[0], qname[1], data)
</del><ins>+                format = &quot;Invalid property value stored on server: %s %s&quot;
+                msg = format % (encodeXMLName(*qname), data)
</ins><span class="cx">                 err(None, msg)
</span><span class="cx">                 raise HTTPError(
</span><span class="cx">                     StatusResponse(responsecode.INTERNAL_SERVER_ERROR, msg))
</span><span class="lines">@@ -225,10 +229,10 @@
</span><span class="cx">                 if e.errno not in _ATTR_MISSING:
</span><span class="cx">                     raise
</span><span class="cx">         except:
</span><del>-            raise HTTPError(
-                StatusResponse(
-                    statusForFailure(Failure()),
-                    &quot;Unable to delete property: &quot; + key))
</del><ins>+            raise HTTPError(StatusResponse(
+                statusForFailure(Failure()),
+                &quot;Unable to delete property: %s&quot;, (key,)
+            ))
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def contains(self, qname, uid=None):
</span><span class="lines">@@ -252,10 +256,10 @@
</span><span class="cx">         except IOError, e:
</span><span class="cx">             if e.errno in _ATTR_MISSING or e.errno == errno.ENOENT:
</span><span class="cx">                 return False
</span><del>-            raise HTTPError(
-                StatusResponse(
-                    statusForFailure(Failure()),
-                    &quot;Unable to read property: &quot; + key))
</del><ins>+            raise HTTPError(StatusResponse(
+                statusForFailure(Failure()),
+                &quot;Unable to read property: %s&quot; % (key,)
+            ))
</ins><span class="cx">         else:
</span><span class="cx">             return True
</span><span class="cx"> 
</span><span class="lines">@@ -277,10 +281,10 @@
</span><span class="cx">         except IOError, e:
</span><span class="cx">             if e.errno == errno.ENOENT:
</span><span class="cx">                 return []
</span><del>-            raise HTTPError(
-                StatusResponse(
-                    statusForFailure(Failure()),
-                    &quot;Unable to list properties: &quot; + self.resource.fp.path))
</del><ins>+            raise HTTPError(StatusResponse(
+                statusForFailure(Failure()),
+                &quot;Unable to list properties: %s&quot;, (self.resource.fp.path,)
+            ))
</ins><span class="cx">         else:
</span><span class="cx">             results = [
</span><span class="cx">                 self._decode(name)
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavextensionspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/extensions.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/extensions.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/extensions.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> from twext.web2.stream import FileStream
</span><span class="cx"> from twext.web2.static import MetaDataMixin, StaticRenderMixin
</span><span class="cx"> from txdav.xml import element
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> from txdav.xml.element import dav_namespace
</span><span class="cx"> from twext.web2.dav.http import MultiStatusResponse
</span><span class="cx"> from twext.web2.dav.static import DAVFile as SuperDAVFile
</span><span class="lines">@@ -339,8 +340,8 @@
</span><span class="cx">             whenAllProperties = gatherResults([
</span><span class="cx">                 maybeDeferred(self.resource.readProperty, qn, request)
</span><span class="cx">                 .addCallback(lambda p, iqn=qn: (p.sname(), p.toxml())
</span><del>-                             if p is not None else (&quot;{%s}%s&quot; % iqn, None) )
-                .addErrback(gotError, &quot;{%s}%s&quot; % qn)
</del><ins>+                             if p is not None else (encodeXMLName(*iqn), None) )
+                .addErrback(gotError, encodeXMLName(*qn))
</ins><span class="cx">                 for qn in sorted(qnames)
</span><span class="cx">             ])
</span><span class="cx"> 
</span><span class="lines">@@ -771,7 +772,7 @@
</span><span class="cx">         HTTPError.__init__(self,
</span><span class="cx">             StatusResponse(
</span><span class="cx">                 responsecode.NOT_FOUND,
</span><del>-                &quot;No such property: {%s}%s&quot; % qname
</del><ins>+                &quot;No such property: %s&quot; % encodeXMLName(*qname)
</ins><span class="cx">             )
</span><span class="cx">         )
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavmemcachepropspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/memcacheprops.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/memcacheprops.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/memcacheprops.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> from twext.python.memcacheclient import ClientFactory
</span><span class="cx"> from twext.python.memcacheclient import MemcacheError, TokenMismatchError
</span><span class="cx"> from twext.python.filepath import CachingFilePath as FilePath
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> from twext.web2 import responsecode
</span><span class="cx"> from twext.web2.http import HTTPError, StatusResponse
</span><span class="cx"> 
</span><span class="lines">@@ -293,11 +294,10 @@
</span><span class="cx">             else:
</span><span class="cx">                 log.error(&quot;memcacheprops setProperty had too many failures&quot;)
</span><span class="cx">                 delattr(self, &quot;_propertyCache&quot;)
</span><del>-                raise MemcacheError(&quot;Unable to %s property %s{%s}%s on %s&quot; % (
</del><ins>+                raise MemcacheError(&quot;Unable to %s property %s%s on %s&quot; % (
</ins><span class="cx">                     &quot;delete&quot; if delete else &quot;set&quot;,
</span><span class="cx">                     uid if uid else &quot;&quot;,
</span><del>-                    qname[0],
-                    qname[1],
</del><ins>+                    encodeXMLName(*qname),
</ins><span class="cx">                     child
</span><span class="cx">                 ))
</span><span class="cx"> 
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx">                 else:
</span><span class="cx">                     raise HTTPError(StatusResponse(
</span><span class="cx">                         responsecode.NOT_FOUND,
</span><del>-                        &quot;No such property: %s{%s}%s&quot; % (uid if uid else &quot;&quot;, qname[0], qname[1],)
</del><ins>+                        &quot;No such property: %s%s&quot; % (uid if uid else &quot;&quot;, encodeXMLName(*qname))
</ins><span class="cx">                     ))
</span><span class="cx"> 
</span><span class="cx">             self.log_debug(&quot;Read for %s%s on %s&quot; % (
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavmethodreportpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/method/report.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/method/report.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/method/report.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> from twext.web2.http import HTTPError, StatusResponse
</span><span class="cx"> from twext.web2.dav.util import davXMLFromStream
</span><span class="cx"> from txdav.xml import element as davxml
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> from txdav.xml.element import lookupElement
</span><span class="cx"> 
</span><span class="cx"> from twext.python.log import Logger
</span><span class="lines">@@ -78,7 +79,7 @@
</span><span class="cx">         elif namespace == caldavxml.caldav_namespace:
</span><span class="cx">             request.submethod = &quot;CalDAV:&quot; + name
</span><span class="cx">         else:
</span><del>-            request.submethod = &quot;{%s}%s&quot; % (namespace, name)
</del><ins>+            request.submethod = encodeXMLName(namespace, name)
</ins><span class="cx">     else:
</span><span class="cx">         request.submethod = name
</span><span class="cx"> 
</span><span class="lines">@@ -114,8 +115,8 @@
</span><span class="cx">         #
</span><span class="cx">         # Requested report is not supported.
</span><span class="cx">         #
</span><del>-        log.err(&quot;Unsupported REPORT {%s}%s for resource %s (no method %s)&quot;
-                % (namespace, name, self, method_name))
</del><ins>+        log.err(&quot;Unsupported REPORT %s for resource %s (no method %s)&quot;
+                % (encodeXMLName(namespace, name), self, method_name))
</ins><span class="cx"> 
</span><span class="cx">         raise HTTPError(ErrorResponse(
</span><span class="cx">             responsecode.FORBIDDEN,
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/storebridge.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/storebridge.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -15,27 +15,38 @@
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><span class="cx"> 
</span><ins>+import time
+import hashlib
+from urlparse import urlsplit
+
+from twisted.python.hashlib import md5
+from twisted.python.log import err as logDefaultException
+from twisted.python.util import FancyEqMixin
+from twisted.internet.defer import succeed, inlineCallbacks, returnValue, maybeDeferred
+from twisted.internet.protocol import Protocol
+
</ins><span class="cx"> from twext.python.log import Logger
</span><ins>+
+from txdav.xml import element as davxml
+from txdav.xml.base import dav_namespace, WebDAVUnknownElement, encodeXMLName
+from txdav.base.propertystore.base import PropertyName
+from txdav.caldav.icalendarstore import QuotaExceeded
+from txdav.common.icommondatastore import NoSuchObjectResourceError
+from txdav.idav import PropertyChangeNotAllowedError
+
</ins><span class="cx"> from twext.web2 import responsecode
</span><del>-from txdav.xml import element as davxml
-from txdav.xml.base import dav_namespace, WebDAVUnknownElement
</del><ins>+from twext.web2.stream import ProducerStream, readStream, MemoryStream
+from twext.web2.http import HTTPError, StatusResponse, Response
+from twext.web2.http_headers import ETag, MimeType
</ins><span class="cx"> from twext.web2.dav.http import ErrorResponse, ResponseQueue, MultiStatusResponse
</span><span class="cx"> from twext.web2.dav.noneprops import NonePropertyStore
</span><span class="cx"> from twext.web2.dav.resource import TwistedACLInheritable, AccessDeniedError
</span><span class="cx"> from twext.web2.dav.util import parentForURL, allDataFromStream, joinURL, davXMLFromStream
</span><del>-from twext.web2.http import HTTPError, StatusResponse, Response
-from twext.web2.http_headers import ETag, MimeType
</del><span class="cx"> from twext.web2.responsecode import (
</span><span class="cx">     FORBIDDEN, NO_CONTENT, NOT_FOUND, CREATED, CONFLICT, PRECONDITION_FAILED,
</span><span class="cx">     BAD_REQUEST, OK, INSUFFICIENT_STORAGE_SPACE
</span><span class="cx"> )
</span><span class="cx"> 
</span><del>-from twext.web2.stream import ProducerStream, readStream, MemoryStream
-from twisted.internet.defer import succeed, inlineCallbacks, returnValue, maybeDeferred
-from twisted.internet.protocol import Protocol
-from twisted.python.hashlib import md5
-from twisted.python.log import err as logDefaultException
-from twisted.python.util import FancyEqMixin
</del><span class="cx"> from twistedcaldav import customxml, carddavxml, caldavxml
</span><span class="cx"> from twistedcaldav.cache import CacheStoreNotifier, ResponseCacheMixin,\
</span><span class="cx">     DisabledCacheNotifier
</span><span class="lines">@@ -56,15 +67,6 @@
</span><span class="cx"> from twistedcaldav.scheduling.implicit import ImplicitScheduler
</span><span class="cx"> from twistedcaldav.vcard import Component as VCard, InvalidVCardDataError
</span><span class="cx"> 
</span><del>-from txdav.base.propertystore.base import PropertyName
-from txdav.caldav.icalendarstore import QuotaExceeded
-from txdav.common.icommondatastore import NoSuchObjectResourceError
-from txdav.idav import PropertyChangeNotAllowedError
-
-import time
-import hashlib
-from urlparse import urlsplit
-
</del><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> Wrappers to translate between the APIs in L{txdav.caldav.icalendarstore} and
</span><span class="cx"> L{txdav.carddav.iaddressbookstore} and those in L{twistedcaldav}.
</span><span class="lines">@@ -101,7 +103,7 @@
</span><span class="cx">         except KeyError:
</span><span class="cx">             raise HTTPError(StatusResponse(
</span><span class="cx">                 NOT_FOUND,
</span><del>-                &quot;No such property: {%s}%s&quot; % qname
</del><ins>+                &quot;No such property: %s&quot; % (encodeXMLName(*qname),)
</ins><span class="cx">             ))
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -111,7 +113,7 @@
</span><span class="cx">         except PropertyChangeNotAllowedError:
</span><span class="cx">             raise HTTPError(StatusResponse(
</span><span class="cx">                 FORBIDDEN,
</span><del>-                &quot;Property cannot be changed: {%s}%s&quot; % property.qname(),
</del><ins>+                &quot;Property cannot be changed: %s&quot; % (property.sname(),)
</ins><span class="cx">             ))
</span><span class="cx">             
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavtesttest_memcachepropspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> import os
</span><span class="cx"> 
</span><ins>+from twext.xml.base import encodeXMLName
</ins><span class="cx"> from twext.web2.http import HTTPError
</span><span class="cx"> 
</span><span class="cx"> from twistedcaldav.memcacheprops import MemcachePropertyCollection
</span><span class="lines">@@ -33,7 +34,6 @@
</span><span class="cx"> from twistedcaldav.test.util import TestCase
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> class StubCollection(object):
</span><span class="cx"> 
</span><span class="cx">     def __init__(self, path, childNames):
</span><span class="lines">@@ -91,9 +91,8 @@
</span><span class="cx">     def qname(self):
</span><span class="cx">         return self.ns, self.name
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     def __repr__(self):
</span><del>-        return &quot;{%s}%s = %s&quot; % (self.ns, self.name, self.value)
</del><ins>+        return &quot;%s = %s&quot; % (encodeXMLName(self.ns, self.name), self.value)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class MemcachePropertyCollectionTestCase(TestCase):
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavtesttest_validationpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/test/test_validation.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/test/test_validation.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/twistedcaldav/test/test_validation.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -118,10 +118,7 @@
</span><span class="cx">             element = XML(err.response.stream.mem)[0]
</span><span class="cx">             self.assertEquals(
</span><span class="cx">                 element.tag,
</span><del>-                &quot;{%s}%s&quot; % (
-                    MaxAttendeesPerInstance.namespace,
-                    MaxAttendeesPerInstance.name
-                )
</del><ins>+                MaxAttendeesPerInstance.sname()
</ins><span class="cx">             )
</span><span class="cx">             self.assertEquals(int(element.text), config.MaxAttendeesPerInstance)
</span><span class="cx">         else:
</span><span class="lines">@@ -165,10 +162,7 @@
</span><span class="cx">             element = XML(err.response.stream.mem)[0]
</span><span class="cx">             self.assertEquals(
</span><span class="cx">                 element.tag,
</span><del>-                &quot;{%s}%s&quot; % (
-                    MaxAttendeesPerInstance.namespace,
-                    MaxAttendeesPerInstance.name
-                )
</del><ins>+                MaxAttendeesPerInstance.sname()
</ins><span class="cx">             )
</span><span class="cx">             self.assertEquals(int(element.text), config.MaxAttendeesPerInstance)
</span><span class="cx">         else:
</span></span></pre></div>
<a id="CalendarServertrunktxdavbasepropertystorebasepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/base/propertystore/base.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/base/propertystore/base.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/txdav/base/propertystore/base.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> from twext.python.log import LoggingMixIn
</span><span class="cx"> from txdav.xml import element as davxml
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> from twext.web2.dav.resource import TwistedGETContentMD5,\
</span><span class="cx">     TwistedQuotaRootProperty
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +90,7 @@
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx">     def toString(self):
</span><del>-        return &quot;{%s}%s&quot; % (self.namespace, self.name)
</del><ins>+        return encodeXMLName(self.namespace, self.name)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class AbstractPropertyStore(LoggingMixIn, DictMixin):
</span></span></pre></div>
<a id="CalendarServertrunktxdavbasepropertystorexattrpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/base/propertystore/xattr.py (9471 => 9472)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/base/propertystore/xattr.py        2012-07-20 22:45:01 UTC (rev 9471)
+++ CalendarServer/trunk/txdav/base/propertystore/xattr.py        2012-07-20 22:46:08 UTC (rev 9472)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> from twisted.python.reflect import namedAny
</span><span class="cx"> 
</span><ins>+from txdav.xml.base import encodeXMLName
</ins><span class="cx"> from txdav.xml.parser import WebDAVDocument
</span><span class="cx"> from txdav.base.propertystore.base import AbstractPropertyStore, PropertyName,\
</span><span class="cx">         validKey
</span><span class="lines">@@ -116,7 +117,7 @@
</span><span class="cx">                                                     qname.namespace)
</span><span class="cx">         else:
</span><span class="cx">             namespace = qname.namespace
</span><del>-        result = urllib.quote(&quot;{%s}%s&quot; % (namespace, qname.name), safe=&quot;{}:&quot;)
</del><ins>+        result = urllib.quote(encodeXMLName(namespace, qname.name), safe=&quot;{}:&quot;)
</ins><span class="cx">         if uid and uid != self._defaultUser:
</span><span class="cx">             result = uid + result
</span><span class="cx">         r = self.deadPropertyXattrPrefix + result
</span></span></pre>
</div>
</div>

</body>
</html>