<!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>[14220] twext/trunk/twext/who/opendirectory</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/14220">14220</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-12-11 10:56:21 -0800 (Thu, 11 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix the autorelease pool</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#twexttrunktwextwhoopendirectory_servicepy">twext/trunk/twext/who/opendirectory/_service.py</a></li>
<li><a href="#twexttrunktwextwhoopendirectorytesttest_servicepy">twext/trunk/twext/who/opendirectory/test/test_service.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="twexttrunktwextwhoopendirectory_servicepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/who/opendirectory/_service.py (14219 => 14220)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/who/opendirectory/_service.py        2014-12-11 18:31:23 UTC (rev 14219)
+++ twext/trunk/twext/who/opendirectory/_service.py        2014-12-11 18:56:21 UTC (rev 14220)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> OpenDirectory directory service implementation.
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+from time import time
</ins><span class="cx"> from uuid import UUID
</span><span class="cx"> from zope.interface import implementer
</span><span class="cx"> 
</span><span class="lines">@@ -159,6 +160,46 @@
</span><span class="cx">         self._suppressSystemRecords = suppressSystemRecords
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+        # Create an autorelease pool which will get deleted when someone
+        # calls _maybeDrainPool( ), but no more often than 60 seconds, hence
+        # the &quot;maybe&quot;
+        self._resetAutoreleasePool()
+
+        # Register a pool delete to happen at shutdown
+        from twisted.internet import reactor
+        reactor.addSystemEventTrigger(&quot;after&quot;, &quot;shutdown&quot;, self._deletePool)
+
+
+    def _deletePool(self):
+        &quot;&quot;&quot;
+        Delete the autorelease pool if we have one
+        &quot;&quot;&quot;
+        if hasattr(self, &quot;_autoReleasePool&quot;):
+            del self._autoReleasePool
+
+
+    def _resetAutoreleasePool(self):
+        &quot;&quot;&quot;
+        Create an autorelease pool, deleting the old one if we had one.
+        &quot;&quot;&quot;
+        self._deletePool()
+
+        self._autoReleasePool = NSAutoreleasePool.alloc().init()
+        self._poolCreationTime = time()
+
+
+    def _maybeResetPool(self):
+        &quot;&quot;&quot;
+        If it's been at least 60 seconds since the last time we created the
+        pool, delete the pool (which drains it) and create a new one.
+        &quot;&quot;&quot;
+        poolCreationTime = getattr(self, &quot;_poolCreationTime&quot;, 0)
+        now = time()
+        if (now - poolCreationTime) &gt; 60:
+            self._resetAutoreleasePool()
+
+
+
</ins><span class="cx">     @property
</span><span class="cx">     def nodeName(self):
</span><span class="cx">         return self._nodeName
</span><span class="lines">@@ -758,11 +799,12 @@
</span><span class="cx">         returnValue(result)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @wrapWithAutoreleasePool
</del><span class="cx">     def recordsFromNonCompoundExpression(
</span><span class="cx">         self, expression, recordTypes=None, records=None,
</span><span class="cx">         limitResults=None, timeoutSeconds=None
</span><span class="cx">     ):
</span><ins>+        self._maybeResetPool()
+
</ins><span class="cx">         if isinstance(expression, MatchExpression):
</span><span class="cx">             try:
</span><span class="cx">                 query = self._queryFromMatchExpression(
</span><span class="lines">@@ -786,7 +828,6 @@
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @wrapWithAutoreleasePool
</del><span class="cx">     @inlineCallbacks
</span><span class="cx">     def recordsFromCompoundExpression(
</span><span class="cx">         self, expression, recordTypes=None, records=None,
</span><span class="lines">@@ -800,6 +841,7 @@
</span><span class="cx">         CompoundExpression up into MatchExpressions for sending to the local
</span><span class="cx">         node.
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+        self._maybeResetPool()
</ins><span class="cx"> 
</span><span class="cx">         try:
</span><span class="cx">             query = self._queryFromCompoundExpression(
</span><span class="lines">@@ -834,7 +876,6 @@
</span><span class="cx">         returnValue(results)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @wrapWithAutoreleasePool
</del><span class="cx">     @inlineCallbacks
</span><span class="cx">     def localRecordsFromCompoundExpression(
</span><span class="cx">         self, expression, recordTypes=None,
</span><span class="lines">@@ -940,9 +981,10 @@
</span><span class="cx">         ))
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @wrapWithAutoreleasePool
</del><span class="cx">     @inlineCallbacks
</span><span class="cx">     def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</span><ins>+        self._maybeResetPool()
+
</ins><span class="cx">         try:
</span><span class="cx">             query = self._queryFromMatchExpression(
</span><span class="cx">                 MatchExpression(self.fieldName.shortNames, shortName),
</span></span></pre></div>
<a id="twexttrunktwextwhoopendirectorytesttest_servicepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/who/opendirectory/test/test_service.py (14219 => 14220)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/who/opendirectory/test/test_service.py        2014-12-11 18:31:23 UTC (rev 14219)
+++ twext/trunk/twext/who/opendirectory/test/test_service.py        2014-12-11 18:56:21 UTC (rev 14220)
</span><span class="lines">@@ -35,16 +35,22 @@
</span><span class="cx">     Tests for L{DirectoryService}.
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+    def setUp(self):
+        self.service = DirectoryService()
+
+    def tearDown(self):
+        self.service._deletePool()
+
+
</ins><span class="cx">     def test_queryFromMatchExpression_recordType(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Make sure queryFromMatchExpression handles recordType correctly
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-        query = service._queryFromMatchExpression(
</del><ins>+        query = self.service._queryFromMatchExpression(
</ins><span class="cx">             MatchExpression(
</span><del>-                service.fieldName.shortNames, u&quot;xyzzy&quot;
</del><ins>+                self.service.fieldName.shortNames, u&quot;xyzzy&quot;
</ins><span class="cx">             ),
</span><del>-            recordType=service.recordType.group
</del><ins>+            recordType=self.service.recordType.group
</ins><span class="cx">         )
</span><span class="cx">         # FIXME:
</span><span class="cx">         # Actually, how do we inspect the query object to peek at the
</span><span class="lines">@@ -59,8 +65,6 @@
</span><span class="cx">         Match expressions with each match type produces the correct
</span><span class="cx">         operator=value string.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         for matchType, expected in (
</span><span class="cx">             (MatchType.equals, u&quot;=xyzzy&quot;),
</span><span class="cx">             (MatchType.startsWith, u&quot;=xyzzy*&quot;),
</span><span class="lines">@@ -72,10 +76,10 @@
</span><span class="cx">             (MatchType.greaterThanOrEqualTo, u&quot;&gt;=xyzzy&quot;),
</span><span class="cx">         ):
</span><span class="cx">             expression = MatchExpression(
</span><del>-                service.fieldName.shortNames, u&quot;xyzzy&quot;,
</del><ins>+                self.service.fieldName.shortNames, u&quot;xyzzy&quot;,
</ins><span class="cx">                 matchType=matchType
</span><span class="cx">             )
</span><del>-            queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+            queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">             self.assertEquals(
</span><span class="cx">                 recordTypes,
</span><span class="cx">                 set(
</span><span class="lines">@@ -99,13 +103,11 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Match expression with the C{NOT} flag adds the C{!} operator.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         expression = MatchExpression(
</span><del>-            service.fieldName.shortNames, u&quot;xyzzy&quot;,
</del><ins>+            self.service.fieldName.shortNames, u&quot;xyzzy&quot;,
</ins><span class="cx">             flags=MatchFlags.NOT
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             recordTypes,
</span><span class="cx">             set(
</span><span class="lines">@@ -130,13 +132,11 @@
</span><span class="cx">         Match expression with the C{caseInsensitive} flag adds the C{??????}
</span><span class="cx">         operator.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         expression = MatchExpression(
</span><del>-            service.fieldName.shortNames, u&quot;xyzzy&quot;,
</del><ins>+            self.service.fieldName.shortNames, u&quot;xyzzy&quot;,
</ins><span class="cx">             flags=MatchFlags.caseInsensitive
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             recordTypes,
</span><span class="cx">             set(
</span><span class="lines">@@ -164,13 +164,11 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Special characters are quoted properly.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         expression = MatchExpression(
</span><del>-            service.fieldName.fullNames,
</del><ins>+            self.service.fieldName.fullNames,
</ins><span class="cx">             u&quot;\\xyzzy: a/b/(c)* ~~ &gt;=&lt; ~~ &amp;| \0!!&quot;
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             recordTypes,
</span><span class="cx">             set(
</span><span class="lines">@@ -193,36 +191,34 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def test_queryStringFromExpression(self):
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         # CompoundExpressions
</span><span class="cx"> 
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.uid, u&quot;a&quot;,
</del><ins>+                    self.service.fieldName.uid, u&quot;a&quot;,
</ins><span class="cx">                     matchType=MatchType.contains
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.guid, UUID(int=0),
</del><ins>+                    self.service.fieldName.guid, UUID(int=0),
</ins><span class="cx">                     matchType=MatchType.contains
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames, u&quot;c&quot;,
</del><ins>+                    self.service.fieldName.shortNames, u&quot;c&quot;,
</ins><span class="cx">                     matchType=MatchType.contains
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.emailAddresses, u&quot;d&quot;,
</del><ins>+                    self.service.fieldName.emailAddresses, u&quot;d&quot;,
</ins><span class="cx">                     matchType=MatchType.startsWith
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.fullNames, u&quot;e&quot;,
</del><ins>+                    self.service.fieldName.fullNames, u&quot;e&quot;,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="cx">             Operand.AND
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             recordTypes,
</span><span class="cx">             set(
</span><span class="lines">@@ -249,21 +245,21 @@
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames, u&quot;a&quot;,
</del><ins>+                    self.service.fieldName.shortNames, u&quot;a&quot;,
</ins><span class="cx">                     matchType=MatchType.contains
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.emailAddresses, u&quot;b&quot;,
</del><ins>+                    self.service.fieldName.emailAddresses, u&quot;b&quot;,
</ins><span class="cx">                     matchType=MatchType.startsWith
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.fullNames, u&quot;c&quot;,
</del><ins>+                    self.service.fieldName.fullNames, u&quot;c&quot;,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="cx">             Operand.OR
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             recordTypes,
</span><span class="cx">             set(
</span><span class="lines">@@ -289,30 +285,28 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Record type in expression
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        service = DirectoryService()
-
</del><span class="cx">         # AND expression
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames,
</del><ins>+                    self.service.fieldName.shortNames,
</ins><span class="cx">                     u&quot;xyzzy&quot;,
</span><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.recordType,
-                    service.recordType.group,
</del><ins>+                    self.service.fieldName.recordType,
+                    self.service.recordType.group,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.recordType,
-                    service.recordType.user,
</del><ins>+                    self.service.fieldName.recordType,
+                    self.service.recordType.user,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="cx">             Operand.AND
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(recordTypes, set())
</span><span class="cx">         self.assertEquals(
</span><span class="cx">             queryString,
</span><span class="lines">@@ -323,7 +317,7 @@
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames,
</del><ins>+                    self.service.fieldName.shortNames,
</ins><span class="cx">                     u&quot;xxxxx&quot;,
</span><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="lines">@@ -331,12 +325,12 @@
</span><span class="cx">                     [
</span><span class="cx"> 
</span><span class="cx">                         MatchExpression(
</span><del>-                            service.fieldName.recordType,
-                            service.recordType.group,
</del><ins>+                            self.service.fieldName.recordType,
+                            self.service.recordType.group,
</ins><span class="cx">                             matchType=MatchType.equals
</span><span class="cx">                         ),
</span><span class="cx">                         MatchExpression(
</span><del>-                            service.fieldName.shortNames,
</del><ins>+                            self.service.fieldName.shortNames,
</ins><span class="cx">                             u&quot;yyyyy&quot;,
</span><span class="cx">                             matchType=MatchType.equals
</span><span class="cx">                         ),
</span><span class="lines">@@ -346,7 +340,7 @@
</span><span class="cx">             ],
</span><span class="cx">             Operand.OR
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(set(recordTypes), set([u&quot;dsRecTypeStandard:Groups&quot;, ]))
</span><span class="cx">         self.assertEquals(
</span><span class="cx">             queryString,
</span><span class="lines">@@ -359,25 +353,25 @@
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames,
</del><ins>+                    self.service.fieldName.shortNames,
</ins><span class="cx">                     u&quot;xxxxx&quot;,
</span><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.shortNames,
</del><ins>+                    self.service.fieldName.shortNames,
</ins><span class="cx">                     u&quot;yyyyy&quot;,
</span><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.recordType,
-                    service.recordType.user,
</del><ins>+                    self.service.fieldName.recordType,
+                    self.service.recordType.user,
</ins><span class="cx">                     matchType=MatchType.equals,
</span><span class="cx">                     flags=MatchFlags.NOT
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="cx">             Operand.OR
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(
</span><span class="cx">             set(recordTypes),
</span><span class="cx">             set(
</span><span class="lines">@@ -400,14 +394,14 @@
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.recordType,
-                    service.recordType.user,
</del><ins>+                    self.service.fieldName.recordType,
+                    self.service.recordType.user,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="cx">             Operand.AND
</span><span class="cx">         )
</span><del>-        queryString, recordTypes = service._queryStringAndRecordTypesFromExpression(expression)
</del><ins>+        queryString, recordTypes = self.service._queryStringAndRecordTypesFromExpression(expression)
</ins><span class="cx">         self.assertEquals(set(recordTypes), set([u&quot;dsRecTypeStandard:Users&quot;]))
</span><span class="cx">         self.assertEquals(
</span><span class="cx">             queryString,
</span><span class="lines">@@ -418,8 +412,8 @@
</span><span class="cx">         expression = CompoundExpression(
</span><span class="cx">             [
</span><span class="cx">                 MatchExpression(
</span><del>-                    service.fieldName.recordType,
-                    service.recordType.user,
</del><ins>+                    self.service.fieldName.recordType,
+                    self.service.recordType.user,
</ins><span class="cx">                     matchType=MatchType.equals
</span><span class="cx">                 ),
</span><span class="cx">             ],
</span><span class="lines">@@ -427,6 +421,6 @@
</span><span class="cx">         )
</span><span class="cx">         self.assertRaises(
</span><span class="cx">             QueryNotSupportedError,
</span><del>-            service._queryStringAndRecordTypesFromExpression,
</del><ins>+            self.service._queryStringAndRecordTypesFromExpression,
</ins><span class="cx">             expression,
</span><span class="cx">         )
</span></span></pre>
</div>
</div>

</body>
</html>