changeset 1394:7bad9a3b1c15

Added authentication support for the remaining RPC calls.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Mon, 21 Aug 2006 16:35:58 +0200
parents e6e054247a58
children b7ca51e9be1e
files MoinMoin/wikisync.py docs/CHANGES.aschremmer
diffstat 2 files changed, 24 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikisync.py	Mon Aug 21 16:09:12 2006 +0200
+++ b/MoinMoin/wikisync.py	Mon Aug 21 16:35:58 2006 +0200
@@ -214,7 +214,13 @@
         """ Returns the binary diff of the remote page named pagename, given
             from_rev and to_rev. """
         try:
-            result = self.connection.getDiff(pagename, from_rev, to_rev, n_name)
+            if self.token:
+                m = MultiCall(self.connection)
+                m.applyAuthToken(self.token)
+                m.getDiff(pagename, from_rev, to_rev, n_name)
+                tokres, result = m()
+            else:
+                result = self.connection.getDiff(pagename, from_rev, to_rev, n_name)
         except xmlrpclib.Fault, e:
             if e.faultCode == "INVALID_TAG":
                 return None
@@ -225,7 +231,13 @@
     def merge_diff(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name, n_name):
         """ Merges the diff into the page on the remote side. """
         try:
-            result = self.connection.mergeDiff(pagename, xmlrpclib.Binary(diff), local_rev, delta_remote_rev, last_remote_rev, interwiki_name, n_name)
+            if self.token:
+                m = MultiCall(self.connection)
+                m.applyAuthToken(self.token)
+                m.mergeDiff(pagename, xmlrpclib.Binary(diff), local_rev, delta_remote_rev, last_remote_rev, interwiki_name, n_name)
+                tokres, result = m()
+            else:
+                result = self.connection.mergeDiff(pagename, xmlrpclib.Binary(diff), local_rev, delta_remote_rev, last_remote_rev, interwiki_name, n_name)
         except xmlrpclib.Fault, e:
             if e.faultCode == "NOT_ALLOWED":
                 raise NotAllowedException
@@ -234,7 +246,13 @@
 
     def delete_page(self, pagename, last_remote_rev, interwiki_name):
         try:
-            result = self.connection.mergeDiff(pagename, None, None, None, last_remote_rev, interwiki_name, None)
+            if self.token:
+                m = MultiCall(self.connection)
+                m.applyAuthToken(self.token)
+                m.mergeDiff(pagename, None, None, None, last_remote_rev, interwiki_name, None)
+                tokres, result = m()
+            else:
+                result = self.connection.mergeDiff(pagename, None, None, None, last_remote_rev, interwiki_name, None)
         except xmlrpclib.Fault, e:
             if e.faultCode == "NOT_ALLOWED":
                 return e.faultString
--- a/docs/CHANGES.aschremmer	Mon Aug 21 16:09:12 2006 +0200
+++ b/docs/CHANGES.aschremmer	Mon Aug 21 16:35:58 2006 +0200
@@ -8,11 +8,9 @@
       (currently done in Pickle files)
 
   ToDo: (this should not go into CHANGES)
-    * Add authentication to the MoinRemoteWiki methods that are left.
     * Reduce round-trip times by caching queries and using MultiCall objects (coroutines?)
-      
-    * Implement a cross-site authentication system, i.e. mainly an
-      identity storage. (does OpenID make sense?)
+    * Implement a password agent. (does OpenID make sense?)
+
     * Maybe refactor YYY into MoinLocalWiki
     * Add page locking, i.e. use the one in the new storage layer (see XXX).
     * Do older tags of one wiki site have to be stored as well? Why don't we
@@ -123,7 +121,7 @@
          Reworked i18n and logging support. Added GetText2 macro. Getting syncing of pages
          working that are just available on one side. Working synchronisation of deleted pages.
          Implemented rollback in case of remote problems and exception logging.
-         Documented this system on MoinMaster.
+         Documented this system on MoinMaster. Added authentication support.
 
 2006-07-18: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-19: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress