diff MoinMoin/auth/interwiki.py @ 2025:d919b7b7b3e9

auth framework: login() methods return an object now This avoids overloading the returned tuple and simplifies code since they can now just instantiate ContinueLogin(), CancelLogin() etc.
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 24 Apr 2007 12:04:19 +0200
parents 1b14cc05a54a
children 340ae0e7529e
line wrap: on
line diff
--- a/MoinMoin/auth/interwiki.py	Mon Apr 23 23:28:03 2007 +0200
+++ b/MoinMoin/auth/interwiki.py	Tue Apr 24 12:04:19 2007 +0200
@@ -11,7 +11,7 @@
 
 import xmlrpclib
 from MoinMoin import auth, wikiutil, user
-from MoinMoin.auth import BaseAuth
+from MoinMoin.auth import BaseAuth, ContinueLogin, CancelLogin
 
 class InterwikiAuth(BaseAuth):
     name = 'interwiki'
@@ -27,7 +27,7 @@
         password = kw.get('password')
 
         if not username or not password:
-            return user_obj, True, None, None
+            return ContinueLogin(user_obj)
 
         if verbose: request.log("interwiki auth: trying to auth %r" % username)
         username = username.replace(' ', ':', 1) # Hack because ':' is not allowed in name field
@@ -35,13 +35,13 @@
 
         if verbose: request.log("interwiki auth: resolve wiki returned: %r %r %r %r" % (wikitag, wikiurl, name, err))
         if err or wikitag not in self.trusted_wikis:
-            return user_obj, True, None, None
+            return ContinueLogin(user_obj)
 
         homewiki = xmlrpclib.Server(wikiurl + "?action=xmlrpc2")
         account_data = homewiki.getUser(name, password)
         if isinstance(account_data, str):
             if verbose: request.log("interwiki auth: %r wiki said: %s" % (wikitag, account_data))
-            return user_obj, True, None, account_data
+            return ContinueLogin(None, account_data)
 
         # TODO: check remote auth_attribs
         u = user.User(request, name=name, auth_method=self.name, auth_attribs=('name', 'aliasname', 'password', 'email', ))
@@ -51,4 +51,4 @@
         u.valid = True
         u.create_or_update(True)
         if verbose: request.log("interwiki: successful auth for %r" % name)
-        return u, True, None, None
+        return ContinueLogin(u)