[CalendarServer-changes] [14287] twext/trunk/twext/who/opendirectory/_service.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 12 13:48:51 PST 2015


Revision: 14287
          http://trac.calendarserver.org//changeset/14287
Author:   sagen at apple.com
Date:     2015-01-12 13:48:51 -0800 (Mon, 12 Jan 2015)
Log Message:
-----------
Don't get OD quoting table from LDAP code

Modified Paths:
--------------
    twext/trunk/twext/who/opendirectory/_service.py

Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py	2015-01-12 21:34:56 UTC (rev 14286)
+++ twext/trunk/twext/who/opendirectory/_service.py	2015-01-12 21:48:51 UTC (rev 14287)
@@ -45,7 +45,6 @@
     CompoundExpression, Operand,
     MatchExpression, MatchFlags,
 )
-from ..ldap._util import LDAP_QUOTING_TABLE
 from ..util import ConstantsContainer, firstResult, uniqueResult
 
 from Foundation import NSAutoreleasePool
@@ -63,7 +62,26 @@
 DEFER_TO_THREAD = False
 
 
+QUOTING_TABLE = {
+    ord(u"\\"): u"\\5C",
+    ord(u"/"): u"\\2F",
 
+    ord(u"("): u"\\28",
+    ord(u")"): u"\\29",
+    ord(u"*"): u"\\2A",
+
+    ord(u"<"): u"\\3C",
+    ord(u"="): u"\\3D",
+    ord(u">"): u"\\3E",
+    ord(u"~"): u"\\7E",
+
+    ord(u"&"): u"\\26",
+    ord(u"|"): u"\\7C",
+
+    ord(u"\0"): u"\\00",
+}
+
+
 def wrapWithAutoreleasePool(f):
     """
     A decorator which creates an autorelease pool and deletes it, causing it
@@ -351,7 +369,7 @@
             value = expression.fieldValue
 
         value = unicode(value)  # We want unicode
-        value = value.translate(LDAP_QUOTING_TABLE)  # Escape special chars
+        value = value.translate(QUOTING_TABLE)  # Escape special chars
 
         return (
             matchType.queryString.format(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150112/2b32e38a/attachment.html>


More information about the calendarserver-changes mailing list