[CalendarServer-changes] [12137] twext/trunk/twext/who/opendirectory/service.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:22:21 PDT 2014


Revision: 12137
          http://trac.calendarserver.org//changeset/12137
Author:   wsanchez at apple.com
Date:     2013-12-18 17:47:58 -0800 (Wed, 18 Dec 2013)
Log Message:
-----------
cosmetic; don't use %-formatting

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

Modified: twext/trunk/twext/who/opendirectory/service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/service.py	2013-12-19 01:44:11 UTC (rev 12136)
+++ twext/trunk/twext/who/opendirectory/service.py	2013-12-19 01:47:58 UTC (rev 12137)
@@ -45,7 +45,7 @@
 
 from twisted.cred.checkers import ICredentialsChecker
 from twisted.cred.credentials import IUsernamePassword, IUsernameHashedPassword
-from twisted.cred.error import UnauthorizedLogin 
+from twisted.cred.error import UnauthorizedLogin
 
 from zope.interface import implements
 from twisted.internet.defer import succeed, fail
@@ -53,6 +53,8 @@
 from twisted.cred.credentials import UsernamePassword, DigestedCredentials
 
 
+
+
 #
 # Exceptions
 #
@@ -600,9 +602,7 @@
                 "Error while executing OpenDirectory query: {error}",
                 error=error
             )
-            raise OpenDirectoryQueryError("Could not look up user",
-                error
-            )
+            raise OpenDirectoryQueryError("Could not look up user", error)
 
         return record
 
@@ -635,7 +635,11 @@
                 try:
                     if "algorithm" not in credentials.fields:
                         credentials.fields["algorithm"] = "md5"
-                    challenge = 'Digest realm="%(realm)s", nonce="%(nonce)s", algorithm=%(algorithm)s' % credentials.fields
+                    challenge = (
+                        'Digest realm="{realm}", nonce="{nonce}", '
+                        'algorithm={algorithm}'
+                        .format(**credentials.fields)
+                    )
                     response = credentials.fields["response"]
                 except KeyError as e:
                     self.log.error(
@@ -654,7 +658,7 @@
                         credentials.method,
                     ],
                     None, None, None
-                    )
+                )
 
                 if not error and result:
                     # return succeed(credentials.username)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/20a81489/attachment.html>


More information about the calendarserver-changes mailing list