Description

I just tried out WikiSynchronisation. I naively set up a SyncJob with our old wiki, which is running 1.5. I know this is not supported, but there is handling code in the wiki synchronisation code that handles this. It just doesn't do it very well, either due to a bug in the wikisync code or the xmlrpc code.

Steps to reproduce

  1. in wikiconfig.py:
    •     interwikiname = u'AnarcatWikiTest'
  2. in the SyncTest page:

    •  remoteWiki:: KoumbitWiki
       pageList:: WikiSandBox

Example

Component selection

Details

MoinMoin Version

1.6alpha (current tip)

OS and Version

Debian GNU/Linux 4.0 "etch"

Python Version

2.4.4

Server Setup

desktop edition

Server Details

Language you are using the wiki in (set in the browser/UserPreferences)

english

Traceback (most recent call last):
  File "/home/anarcat/dist/moin-1.6/MoinMoin/request/__init__.py", line 1215, in run
    handler(self.page.page_name, self)
  File "/home/anarcat/dist/moin-1.6/MoinMoin/action/SyncPages.py", line 497, in execute
    ActionClass(pagename, request).render()
  File "/home/anarcat/dist/moin-1.6/MoinMoin/action/SyncPages.py", line 194, in render
    remote = MoinRemoteWiki(self.request, params["remoteWiki"], params["remotePrefix"], params["pageList"], params["user"], params["password"], verbose=debug)
  File "/home/anarcat/dist/moin-1.6/MoinMoin/wikisync.py", line 195, in __init__
    self.remote_interwikiname = remote_interwikiname = iw_list[0]
KeyError: 0

Workaround

Here is a patch that crudely checks the output of the XML-RPC call. It's weird: the error is returned instead of being raised...

   1 # HG changeset patch
   2 # User anarcat@localhost
   3 # Date 1180486215 14400
   4 # Node ID 5d031abeff35b91ddb8f24f91e158d124bb967bf
   5 # Parent  10fc3d44c45d5a26118f7123a194f7da6ca89142
   6 try to handle gracefully the case where the xmlrpc code doesn't raise the proper exception when remote wiki doesn't support the right extensions
   7 
   8 diff -r 10fc3d44c45d -r 5d031abeff35 MoinMoin/wikisync.py
   9 --- a/MoinMoin/wikisync.py	Tue May 29 20:49:22 2007 -0400
  10 +++ b/MoinMoin/wikisync.py	Tue May 29 20:50:15 2007 -0400
  11 @@ -192,8 +192,16 @@ class MoinRemoteWiki(RemoteWiki):
  12          else:
  13              self.token = None
  14  
  15 -        self.remote_interwikiname = remote_interwikiname = iw_list[0]
  16 -        self.remote_iwid = remote_iwid = iw_list[1]
  17 +	try:
  18 +	        self.remote_interwikiname = remote_interwikiname = iw_list[0]
  19 +        	self.remote_iwid = remote_iwid = iw_list[1]
  20 +	except KeyError:
  21 +		# XXX: some XML-RPC errors don't raise an XML-RPC Fault and propagate through here, catch it manually
  22 +		if iw_list.has_key('faultCode'):
  23 +			raise UnsupportedWikiException(_("The remote version of MoinMoin is too old, version 1.6 is required at least."))
  24 +		else:
  25 +			pass
  26 +
  27          self.is_anonymous = remote_interwikiname is None
  28          if not self.is_anonymous and interwikiname != remote_interwikiname:
  29              raise UnsupportedWikiException(_("The remote wiki uses a different InterWiki name (%(remotename)s)"
workaround.diff

Discussion

The bug probably sits somewhere within xmlrpclib. The wrong method call should raise an exception, but instead it returns it. I tested the code, it just doesn't raise anything... Weird. -- TheAnarcat 2007-05-30 01:08:38

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/1.6devWikiSyncDoesNotDetectOldMoin (last edited 2007-10-29 19:06:33 by localhost)