[CalendarServer-changes] [12625] CalendarServer/trunk/txdav/dps

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:24:48 PDT 2014


Revision: 12625
          http://trac.calendarserver.org//changeset/12625
Author:   sagen at apple.com
Date:     2014-02-08 15:05:59 -0800 (Sat, 08 Feb 2014)
Log Message:
-----------
don't reinvent the wheel.  dict has pop()

Modified Paths:
--------------
    CalendarServer/trunk/txdav/dps/client.py
    CalendarServer/trunk/txdav/dps/server.py

Modified: CalendarServer/trunk/txdav/dps/client.py
===================================================================
--- CalendarServer/trunk/txdav/dps/client.py	2014-02-08 22:59:17 UTC (rev 12624)
+++ CalendarServer/trunk/txdav/dps/client.py	2014-02-08 23:05:59 UTC (rev 12625)
@@ -210,7 +210,7 @@
     record = (yield ds.recordWithShortName(RecordType.user, "sagen"))
     print("short name: {r}".format(r=record))
     if record:
-        authenticated = (yield record.verifyPlaintextPassword("secret"))
+        authenticated = (yield record.verifyPlaintextPassword("negas"))
         print("plain auth: {a}".format(a=authenticated))
     """
     record = (yield ds.recordWithUID("__dre__"))

Modified: CalendarServer/trunk/txdav/dps/server.py
===================================================================
--- CalendarServer/trunk/txdav/dps/server.py	2014-02-08 22:59:17 UTC (rev 12624)
+++ CalendarServer/trunk/txdav/dps/server.py	2014-02-08 23:05:59 UTC (rev 12625)
@@ -323,14 +323,7 @@
     description = "Directory Proxy Service"
     options = DirectoryProxyOptions
 
-    def _extractKeyword(self, key, kwds):
-        result = ""
-        if key in kwds:
-            result = kwds[key]
-            del kwds[key]
-        return result
 
-
     def makeService(self, options):
         """
         Return a service
@@ -350,18 +343,18 @@
             directory = ODDirectoryService(*args, **kwds)
 
         elif directoryType == "LDAP":
-            authDN = self._extractKeyword("authDN", kwds)
-            password = self._extractKeyword("password", kwds)
+            authDN = kwds.pop("authDN", "")
+            password = kwds.pop("password", "")
             if authDN and password:
                 creds = UsernamePassword(authDN, password)
             else:
                 creds = None
             kwds["credentials"] = creds
-            debug = self._extractKeyword("debug", kwds)
+            debug = kwds.pop("debug", "")
             directory = LDAPDirectoryService(*args, _debug=debug, **kwds)
 
         elif directoryType == "XML":
-            path = self._extractKeyword("path", kwds)
+            path = kwds.pop("path", "")
             if not path or not os.path.exists(path):
                 log.error("Path not found for XML directory: {p}", p=path)
             fp = FilePath(path)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/864c47b6/attachment.html>


More information about the calendarserver-changes mailing list