[CalendarServer-changes] [12159] twext/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:15:35 PDT 2014


Revision: 12159
          http://trac.calendarserver.org//changeset/12159
Author:   wsanchez at apple.com
Date:     2013-12-19 16:45:34 -0800 (Thu, 19 Dec 2013)
Log Message:
-----------
unicode yay
compound is not a general match type.

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

Modified: twext/trunk/twext/who/expression.py
===================================================================
--- twext/trunk/twext/who/expression.py	2013-12-20 00:19:14 UTC (rev 12158)
+++ twext/trunk/twext/who/expression.py	2013-12-20 00:45:34 UTC (rev 12159)
@@ -97,11 +97,8 @@
     greaterThanOrEqualTo = NamedConstant()
     greaterThanOrEqualTo.description = u"greater than or equal to"
 
-    compound = NamedConstant()
-    compound.description = u"compound expression"
 
 
-
 class MatchFlags(Flags):
     """
     Match expression flags.

Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py	2013-12-20 00:19:14 UTC (rev 12158)
+++ twext/trunk/twext/who/opendirectory/_service.py	2013-12-20 00:45:34 UTC (rev 12159)
@@ -94,15 +94,15 @@
 
 class FieldName(Names):
     searchPath = NamedConstant()
-    searchPath.description = "search path"
+    searchPath.description = u"search path"
     searchPath.multiValue = False
 
     metaNodeLocation = NamedConstant()
-    metaNodeLocation.description = "source OD node"
+    metaNodeLocation.description = u"source OD node"
     metaNodeLocation.multiValue = False
 
     metaRecordName = NamedConstant()
-    metaRecordName.description = "meta record name"
+    metaRecordName.description = u"meta record name"
     metaRecordName.multiValue = False
 
 
@@ -112,16 +112,16 @@
 #
 
 class ODSearchPath(Values):
-    local = ValueConstant("/Local/Default")
-    search = ValueConstant("/Search")
+    local = ValueConstant(u"/Local/Default")
+    search = ValueConstant(u"/Search")
 
 
 
 class ODRecordType(Values):
-    user = ValueConstant("dsRecTypeStandard:Users")
+    user = ValueConstant(u"dsRecTypeStandard:Users")
     user.recordType = BaseRecordType.user
 
-    group = ValueConstant("dsRecTypeStandard:Groups")
+    group = ValueConstant(u"dsRecTypeStandard:Groups")
     group.recordType = BaseRecordType.group
 
 
@@ -138,33 +138,33 @@
 
 
 class ODAttribute(Values):
-    searchPath = ValueConstant("dsAttrTypeStandard:SearchPath")
+    searchPath = ValueConstant(u"dsAttrTypeStandard:SearchPath")
     searchPath.fieldName = FieldName.searchPath
 
-    recordType = ValueConstant("dsAttrTypeStandard:RecordType")
+    recordType = ValueConstant(u"dsAttrTypeStandard:RecordType")
     recordType.fieldName = BaseFieldName.recordType
 
-    # uid = ValueConstant("dsAttrTypeStandard:GeneratedUID")
+    # uid = ValueConstant(u"dsAttrTypeStandard:GeneratedUID")
     # uid.fieldName = BaseFieldName.uid
 
-    guid = ValueConstant("dsAttrTypeStandard:GeneratedUID")
+    guid = ValueConstant(u"dsAttrTypeStandard:GeneratedUID")
     guid.fieldName = BaseFieldName.guid
 
-    shortName = ValueConstant("dsAttrTypeStandard:RecordName")
+    shortName = ValueConstant(u"dsAttrTypeStandard:RecordName")
     shortName.fieldName = BaseFieldName.shortNames
 
-    fullName = ValueConstant("dsAttrTypeStandard:RealName")
+    fullName = ValueConstant(u"dsAttrTypeStandard:RealName")
     fullName.fieldName = BaseFieldName.fullNames
 
-    emailAddress = ValueConstant("dsAttrTypeStandard:EMailAddress")
+    emailAddress = ValueConstant(u"dsAttrTypeStandard:EMailAddress")
     emailAddress.fieldName = BaseFieldName.emailAddresses
 
     metaNodeLocation = ValueConstant(
-        "dsAttrTypeStandard:AppleMetaNodeLocation"
+        u"dsAttrTypeStandard:AppleMetaNodeLocation"
     )
     metaNodeLocation.fieldName = FieldName.metaNodeLocation
 
-    metaRecordName = ValueConstant("dsAttrTypeStandard:AppleMetaRecordName")
+    metaRecordName = ValueConstant(u"dsAttrTypeStandard:AppleMetaRecordName")
     metaRecordName.fieldName = FieldName.metaRecordName
 
 
@@ -182,6 +182,8 @@
 
 
 class ODMatchType(Values):
+    all = ValueConstant(0x2001)
+
     equals = ValueConstant(0x2001)
     equals.matchType = MatchType.equals
 
@@ -207,7 +209,6 @@
     greaterThanOrEqualTo.matchType = MatchType.greaterThanOrEqualTo
 
     compound = ValueConstant(0x210B)
-    compound.matchType = MatchType.compound
 
 
     @classmethod
@@ -216,17 +217,13 @@
             cls._matchTypeByMatchType = dict((
                 (matchType.matchType, matchType)
                 for matchType in cls.iterconstants()
+                if hasattr(matchType, "matchType")
             ))
 
         return cls._matchTypeByMatchType.get(matchType, None)
 
 
 
-class ODMatchFlags(Values):
-    caseInsensitive = ValueConstant(0x100)
-
-
-
 #
 # Directory Service
 #
@@ -264,7 +261,7 @@
 
     @property
     def realmName(self):
-        return "OpenDirectory Node {self.nodeName!r}".format(self=self)
+        return u"OpenDirectory Node {self.nodeName!r}".format(self=self)
 
 
     @property
@@ -368,6 +365,7 @@
                     "Unknown match type: {0}".format(matchType)
                 )
             odAttr = ODAttribute.fromFieldName(expression.fieldName).value
+            # FIXME: Shouldn't the attr and value be quoted somehow?
             queryString = {
                 ODMatchType.equals.value: u"({attr}={value})",
                 ODMatchType.startsWith.value: u"({attr}={value}*)",
@@ -615,7 +613,7 @@
                 return fail(UnauthorizedLogin("Invalid digest challenge"))
 
             result, m1, m2, error = odRecord.verifyExtendedWithAuthenticationType_authenticationItems_continueItems_context_error_(
-                "dsAuthMethodStandard:dsAuthNodeDIGEST-MD5",
+                u"dsAuthMethodStandard:dsAuthNodeDIGEST-MD5",
                 [
                     credentials.username,
                     challenge,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/fed4cf0f/attachment.html>


More information about the calendarserver-changes mailing list