<!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>[11903] CalendarServer/trunk/twext/who</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/11903">11903</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2013-11-07 11:10:12 -0800 (Thu, 07 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Better type handling:
* Field values have an expected type.
* Most are (default is) `unicode`.
* guid is `UUID`.
* Be explicit about string types everywhere.
Add CompoundExpression class.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktwextwhodirectorypy">CalendarServer/trunk/twext/who/directory.py</a></li>
<li><a href="#CalendarServertrunktwextwhoexpressionpy">CalendarServer/trunk/twext/who/expression.py</a></li>
<li><a href="#CalendarServertrunktwextwhoidirectorypy">CalendarServer/trunk/twext/who/idirectory.py</a></li>
<li><a href="#CalendarServertrunktwextwhoindexpy">CalendarServer/trunk/twext/who/index.py</a></li>
<li><a href="#CalendarServertrunktwextwhotesttest_aggregatepy">CalendarServer/trunk/twext/who/test/test_aggregate.py</a></li>
<li><a href="#CalendarServertrunktwextwhotesttest_directorypy">CalendarServer/trunk/twext/who/test/test_directory.py</a></li>
<li><a href="#CalendarServertrunktwextwhotesttest_expressionpy">CalendarServer/trunk/twext/who/test/test_expression.py</a></li>
<li><a href="#CalendarServertrunktwextwhotesttest_utilpy">CalendarServer/trunk/twext/who/test/test_util.py</a></li>
<li><a href="#CalendarServertrunktwextwhotesttest_xmlpy">CalendarServer/trunk/twext/who/test/test_xml.py</a></li>
<li><a href="#CalendarServertrunktwextwhoxmlpy">CalendarServer/trunk/twext/who/xml.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktwextwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/directory.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/directory.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/directory.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> def __init__(self, realmName):
</span><span class="cx"> """
</span><span class="cx"> @param realmName: a realm name
</span><del>- @type realmName: unicode
</del><ins>+ @type realmName: L{unicode}
</ins><span class="cx"> """
</span><span class="cx"> self.realmName = realmName
</span><span class="cx">
</span><span class="lines">@@ -337,25 +337,31 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def description(self):
</span><del>- description = [self.__class__.__name__, ":"]
</del><ins>+ """
+ Generate a string description of this directory record.
</ins><span class="cx">
</span><ins>+ @return: A description.
+ @rtype: L{unicode}
+ """
+ description = [self.__class__.__name__, u":"]
+
</ins><span class="cx"> for name, value in self.fields.items():
</span><span class="cx"> if hasattr(name, "description"):
</span><span class="cx"> name = name.description
</span><span class="cx"> else:
</span><del>- name = str(name)
</del><ins>+ name = unicode(name)
</ins><span class="cx">
</span><span class="cx"> if hasattr(value, "description"):
</span><span class="cx"> value = value.description
</span><span class="cx"> else:
</span><del>- value = str(value)
</del><ins>+ value = unicode(value)
</ins><span class="cx">
</span><del>- description.append("\n ")
</del><ins>+ description.append(u"\n ")
</ins><span class="cx"> description.append(name)
</span><del>- description.append(" = ")
</del><ins>+ description.append(u" = ")
</ins><span class="cx"> description.append(value)
</span><span class="cx">
</span><del>- return "".join(description)
</del><ins>+ return u"".join(description)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def members(self):
</span></span></pre></div>
<a id="CalendarServertrunktwextwhoexpressionpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/expression.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/expression.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/expression.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -20,6 +20,8 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> __all__ = [
</span><ins>+ "CompoundExpression",
+
</ins><span class="cx"> "MatchType",
</span><span class="cx"> "MatchFlags",
</span><span class="cx"> "MatchExpression",
</span><span class="lines">@@ -30,12 +32,28 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><del>-##
-# Match expression
-##
</del><ins>+#
+# Compound expression
+#
</ins><span class="cx">
</span><ins>+class CompoundExpression(object):
+ """
+ An expression that groups multiple expressions with an operand.
</ins><span class="cx">
</span><ins>+ @ivar expressions: An iterable of expressions.
</ins><span class="cx">
</span><ins>+ @ivar operand: A L{NamedConstant} specifying an operand.
+ """
+
+ def __init__(self, expressions, operand):
+ self.expressions = expressions
+ self.operand = operand
+
+
+#
+# Match expression
+#
+
</ins><span class="cx"> class MatchType(Names):
</span><span class="cx"> """
</span><span class="cx"> Query match types.
</span><span class="lines">@@ -44,9 +62,9 @@
</span><span class="cx"> startsWith = NamedConstant()
</span><span class="cx"> contains = NamedConstant()
</span><span class="cx">
</span><del>- equals.description = "equals"
- startsWith.description = "starts with"
- contains.description = "contains"
</del><ins>+ equals.description = u"equals"
+ startsWith.description = u"starts with"
+ contains.description = u"contains"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -55,10 +73,10 @@
</span><span class="cx"> Match expression flags.
</span><span class="cx"> """
</span><span class="cx"> NOT = FlagConstant()
</span><del>- NOT.description = "not"
</del><ins>+ NOT.description = u"not"
</ins><span class="cx">
</span><span class="cx"> caseInsensitive = FlagConstant()
</span><del>- caseInsensitive.description = "case insensitive"
</del><ins>+ caseInsensitive.description = u"case insensitive"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -88,7 +106,7 @@
</span><span class="cx">
</span><span class="cx"> def __repr__(self):
</span><span class="cx"> def describe(constant):
</span><del>- return getattr(constant, "description", str(constant))
</del><ins>+ return getattr(constant, "description", unicode(constant))
</ins><span class="cx">
</span><span class="cx"> if self.flags is None:
</span><span class="cx"> flags = ""
</span></span></pre></div>
<a id="CalendarServertrunktwextwhoidirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/idirectory.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/idirectory.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/idirectory.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> """
</span><del>-Directory service interface.
</del><ins>+Directory service interfaces.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> __all__ = [
</span><span class="lines">@@ -111,8 +111,8 @@
</span><span class="cx"> user = NamedConstant()
</span><span class="cx"> group = NamedConstant()
</span><span class="cx">
</span><del>- user.description = "user"
- group.description = "group"
</del><ins>+ user.description = u"user"
+ group.description = u"group"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -152,13 +152,13 @@
</span><span class="cx"> emailAddresses = NamedConstant()
</span><span class="cx"> password = NamedConstant()
</span><span class="cx">
</span><del>- uid.description = "UID"
- guid.description = "GUID"
- recordType.description = "record type"
- shortNames.description = "short names"
- fullNames.description = "full names"
- emailAddresses.description = "email addresses"
- password.description = "password"
</del><ins>+ uid.description = u"UID"
+ guid.description = u"GUID"
+ recordType.description = u"record type"
+ shortNames.description = u"short names"
+ fullNames.description = u"full names"
+ emailAddresses.description = u"email addresses"
+ password.description = u"password"
</ins><span class="cx">
</span><span class="cx"> guid.valueType = UUID
</span><span class="cx">
</span><span class="lines">@@ -203,8 +203,8 @@
</span><span class="cx"> OR = NamedConstant()
</span><span class="cx"> AND = NamedConstant()
</span><span class="cx">
</span><del>- OR.description = "or"
- AND.description = "and"
</del><ins>+ OR.description = u"or"
+ AND.description = u"and"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktwextwhoindexpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/index.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/index.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/index.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">
</span><span class="cx"> class FieldName(Names):
</span><span class="cx"> memberUIDs = NamedConstant()
</span><del>- memberUIDs.description = "member UIDs"
</del><ins>+ memberUIDs.description = u"member UIDs"
</ins><span class="cx"> memberUIDs.multiValue = True
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktwextwhotesttest_aggregatepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/test/test_aggregate.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/test/test_aggregate.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/test/test_aggregate.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> class TestService(DirectoryService, QueryMixIn):
</span><span class="cx"> pass
</span><span class="cx">
</span><del>- return TestService("xyzzy", services)
</del><ins>+ return TestService(u"xyzzy", services)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def xmlService(self, xmlData=None, serviceClass=None):
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> class DirectoryServiceBaseTest(BaseTest, test_xml.DirectoryServiceBaseTest):
</span><span class="cx"> def test_repr(self):
</span><span class="cx"> service = self.service()
</span><del>- self.assertEquals(repr(service), "<TestService 'xyzzy'>")
</del><ins>+ self.assertEquals(repr(service), "<TestService u'xyzzy'>")
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktwextwhotesttest_directorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/test/test_directory.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/test/test_directory.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/test/test_directory.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> class ServiceMixIn(object):
</span><del>- realmName = "xyzzy"
</del><ins>+ realmName = u"xyzzy"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def service(self):
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx"> def test_repr(self):
</span><span class="cx"> service = self.service()
</span><del>- self.assertEquals(repr(service), "<DirectoryService 'xyzzy'>")
</del><ins>+ self.assertEquals(repr(service), "<DirectoryService u'xyzzy'>")
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def test_recordTypes(self):
</span><span class="lines">@@ -161,9 +161,9 @@
</span><span class="cx"> newRecord = DirectoryRecord(
</span><span class="cx"> service,
</span><span class="cx"> fields={
</span><del>- service.fieldName.uid: "__plugh__",
</del><ins>+ service.fieldName.uid: u"__plugh__",
</ins><span class="cx"> service.fieldName.recordType: service.recordType.user,
</span><del>- service.fieldName.shortNames: ("plugh",),
</del><ins>+ service.fieldName.shortNames: (u"plugh",),
</ins><span class="cx"> }
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">
</span><span class="cx"> service.removeRecords(())
</span><span class="cx"> self.assertFailure(
</span><del>- service.removeRecords(("foo",)),
</del><ins>+ service.removeRecords((u"foo",)),
</ins><span class="cx"> NotAllowedError,
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -199,41 +199,41 @@
</span><span class="cx">
</span><span class="cx"> class BaseDirectoryRecordTest(ServiceMixIn):
</span><span class="cx"> fields_wsanchez = {
</span><del>- FieldName.uid: "UID:wsanchez",
</del><ins>+ FieldName.uid: u"UID:wsanchez",
</ins><span class="cx"> FieldName.recordType: RecordType.user,
</span><del>- FieldName.shortNames: ("wsanchez", "wilfredo_sanchez"),
</del><ins>+ FieldName.shortNames: (u"wsanchez", u"wilfredo_sanchez"),
</ins><span class="cx"> FieldName.fullNames: (
</span><del>- "Wilfredo Sanchez",
- "Wilfredo Sanchez Vega",
</del><ins>+ u"Wilfredo Sanchez",
+ u"Wilfredo Sanchez Vega",
</ins><span class="cx"> ),
</span><span class="cx"> FieldName.emailAddresses: (
</span><del>- "wsanchez@calendarserver.org",
- "wsanchez@example.com",
</del><ins>+ u"wsanchez@calendarserver.org",
+ u"wsanchez@example.com",
</ins><span class="cx"> )
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> fields_glyph = {
</span><del>- FieldName.uid: "UID:glyph",
</del><ins>+ FieldName.uid: u"UID:glyph",
</ins><span class="cx"> FieldName.recordType: RecordType.user,
</span><del>- FieldName.shortNames: ("glyph",),
- FieldName.fullNames: ("Glyph Lefkowitz",),
- FieldName.emailAddresses: ("glyph@calendarserver.org",)
</del><ins>+ FieldName.shortNames: (u"glyph",),
+ FieldName.fullNames: (u"Glyph Lefkowitz",),
+ FieldName.emailAddresses: (u"glyph@calendarserver.org",)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> fields_sagen = {
</span><del>- FieldName.uid: "UID:sagen",
</del><ins>+ FieldName.uid: u"UID:sagen",
</ins><span class="cx"> FieldName.recordType: RecordType.user,
</span><del>- FieldName.shortNames: ("sagen",),
- FieldName.fullNames: ("Morgen Sagen",),
- FieldName.emailAddresses: ("sagen@CalendarServer.org",)
</del><ins>+ FieldName.shortNames: (u"sagen",),
+ FieldName.fullNames: (u"Morgen Sagen",),
+ FieldName.emailAddresses: (u"sagen@CalendarServer.org",)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> fields_staff = {
</span><del>- FieldName.uid: "UID:staff",
</del><ins>+ FieldName.uid: u"UID:staff",
</ins><span class="cx"> FieldName.recordType: RecordType.group,
</span><del>- FieldName.shortNames: ("staff",),
- FieldName.fullNames: ("Staff",),
- FieldName.emailAddresses: ("staff@CalendarServer.org",)
</del><ins>+ FieldName.shortNames: (u"staff",),
+ FieldName.fullNames: (u"Staff",),
+ FieldName.emailAddresses: (u"staff@CalendarServer.org",)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx"> fields = self.fields_wsanchez.copy()
</span><del>- fields[FieldName.uid] = ""
</del><ins>+ fields[FieldName.uid] = u""
</ins><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -277,7 +277,7 @@
</span><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx"> fields = self.fields_wsanchez.copy()
</span><del>- fields[FieldName.recordType] = ""
</del><ins>+ fields[FieldName.recordType] = None
</ins><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -291,11 +291,11 @@
</span><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx"> fields = self.fields_wsanchez.copy()
</span><del>- fields[FieldName.shortNames] = ("",)
</del><ins>+ fields[FieldName.shortNames] = (u"",)
</ins><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx"> fields = self.fields_wsanchez.copy()
</span><del>- fields[FieldName.shortNames] = ("wsanchez", "")
</del><ins>+ fields[FieldName.shortNames] = (u"wsanchez", u"")
</ins><span class="cx"> self.assertRaises(ValueError, self.makeRecord, fields)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -310,7 +310,7 @@
</span><span class="cx">
</span><span class="cx"> self.assertEquals(
</span><span class="cx"> sagen.fields[FieldName.emailAddresses],
</span><del>- ("sagen@calendarserver.org",)
</del><ins>+ (u"sagen@calendarserver.org",)
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -318,7 +318,7 @@
</span><span class="cx"> fields_glyphmod = self.fields_glyph.copy()
</span><span class="cx"> del fields_glyphmod[FieldName.emailAddresses]
</span><span class="cx">
</span><del>- plugh = DirectoryService("plugh")
</del><ins>+ plugh = DirectoryService(u"plugh")
</ins><span class="cx">
</span><span class="cx"> wsanchez = self.makeRecord(self.fields_wsanchez)
</span><span class="cx"> wsanchezmod = self.makeRecord(self.fields_wsanchez, plugh)
</span></span></pre></div>
<a id="CalendarServertrunktwextwhotesttest_expressionpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/test/test_expression.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/test/test_expression.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/test/test_expression.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -26,29 +26,31 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> class MatchExpressionTest(unittest.TestCase):
</span><del>- def test_repr(self):
</del><ins>+ def test_repr_name(self):
</ins><span class="cx"> self.assertEquals(
</span><del>- "<MatchExpression: 'full names' equals 'Wilfredo Sanchez'>",
</del><ins>+ "<MatchExpression: u'full names' equals u'Wilfredo Sanchez'>",
</ins><span class="cx"> repr(MatchExpression(
</span><span class="cx"> FieldName.fullNames,
</span><del>- "Wilfredo Sanchez",
</del><ins>+ u"Wilfredo Sanchez",
</ins><span class="cx"> )),
</span><span class="cx"> )
</span><span class="cx">
</span><ins>+ def test_repr_type(self):
</ins><span class="cx"> self.assertEquals(
</span><del>- "<MatchExpression: 'full names' contains 'Sanchez'>",
</del><ins>+ "<MatchExpression: u'full names' contains u'Sanchez'>",
</ins><span class="cx"> repr(MatchExpression(
</span><span class="cx"> FieldName.fullNames,
</span><del>- "Sanchez",
</del><ins>+ u"Sanchez",
</ins><span class="cx"> matchType=MatchType.contains,
</span><span class="cx"> )),
</span><span class="cx"> )
</span><span class="cx">
</span><ins>+ def test_repr_flags(self):
</ins><span class="cx"> self.assertEquals(
</span><del>- "<MatchExpression: 'full names' starts with 'Wilfredo' (not)>",
</del><ins>+ "<MatchExpression: u'full names' starts with u'Wilfredo' (not)>",
</ins><span class="cx"> repr(MatchExpression(
</span><span class="cx"> FieldName.fullNames,
</span><del>- "Wilfredo",
</del><ins>+ u"Wilfredo",
</ins><span class="cx"> matchType=MatchType.startsWith,
</span><span class="cx"> flags=MatchFlags.NOT,
</span><span class="cx"> )),
</span></span></pre></div>
<a id="CalendarServertrunktwextwhotesttest_utilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/test/test_util.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/test/test_util.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/test/test_util.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -29,11 +29,11 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> class Tools(Names):
</span><del>- hammer = NamedConstant()
</del><ins>+ hammer = NamedConstant()
</ins><span class="cx"> screwdriver = NamedConstant()
</span><span class="cx">
</span><del>- hammer.description = "nail pounder"
- screwdriver.description = "screw twister"
</del><ins>+ hammer.description = u"nail pounder"
+ screwdriver.description = u"screw twister"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> g = FlagConstant()
</span><span class="cx"> b = FlagConstant()
</span><span class="cx">
</span><del>- r.description = "red"
- g.description = "green"
- b.description = "blue"
</del><ins>+ r.description = u"red"
+ g.description = u"green"
+ b.description = u"blue"
</ins><span class="cx">
</span><span class="cx"> black = FlagConstant()
</span><span class="cx">
</span><span class="lines">@@ -115,10 +115,10 @@
</span><span class="cx"> self.assertRaises(DirectoryServiceError, uniqueResult, (1, 2, 3))
</span><span class="cx">
</span><span class="cx"> def test_describe(self):
</span><del>- self.assertEquals("nail pounder", describe(Tools.hammer))
- self.assertEquals("hammer", describe(Instruments.hammer))
</del><ins>+ self.assertEquals(u"nail pounder", describe(Tools.hammer))
+ self.assertEquals(u"hammer", describe(Instruments.hammer))
</ins><span class="cx">
</span><span class="cx"> def test_describeFlags(self):
</span><del>- self.assertEquals("blue", describe(Switches.b))
- self.assertEquals("red|green", describe(Switches.r | Switches.g))
- self.assertEquals("blue|black", describe(Switches.b | Switches.black))
</del><ins>+ self.assertEquals(u"blue", describe(Switches.b))
+ self.assertEquals(u"red|green", describe(Switches.r | Switches.g))
+ self.assertEquals(u"blue|black", describe(Switches.b | Switches.black))
</ins></span></pre></div>
<a id="CalendarServertrunktwextwhotesttest_xmlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/test/test_xml.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/test/test_xml.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/test/test_xml.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">
</span><span class="cx"> self.assertEquals(repr(service), "<TestService (not loaded)>")
</span><span class="cx"> service.loadRecords()
</span><del>- self.assertEquals(repr(service), "<TestService 'xyzzy'>")
</del><ins>+ self.assertEquals(repr(service), "<TestService u'xyzzy'>")
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span></span></pre></div>
<a id="CalendarServertrunktwextwhoxmlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twext/who/xml.py (11902 => 11903)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twext/who/xml.py        2013-11-07 18:24:00 UTC (rev 11902)
+++ CalendarServer/trunk/twext/who/xml.py        2013-11-07 19:10:12 UTC (rev 11903)
</span><span class="lines">@@ -235,9 +235,9 @@
</span><span class="cx"> "Incorrect root element: {0}".format(directoryNode.tag)
</span><span class="cx"> )
</span><span class="cx">
</span><del>- realmName = directoryNode.get(
</del><ins>+ realmName = unicode(directoryNode.get(
</ins><span class="cx"> self.attribute.realm.value, u""
</span><del>- )
</del><ins>+ ))
</ins><span class="cx">
</span><span class="cx"> if not realmName:
</span><span class="cx"> raise ParseError("No realm name.")
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx"> vType = BaseFieldName.valueType(fieldName)
</span><span class="cx">
</span><span class="cx"> if vType in (unicode, UUID):
</span><del>- value = unicode(fieldNode.text)
</del><ins>+ value = vType(fieldNode.text)
</ins><span class="cx"> else:
</span><span class="cx"> raise AssertionError(
</span><span class="cx"> "Unknown value type {0} for field {1}",
</span></span></pre>
</div>
</div>
</body>
</html>