changeset 2742:0f16bcbc0344

1.6 converter: fix wiki:/localsubpage case
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 21 Aug 2007 14:53:12 +0200
parents 3aae97249905
children 7bfe80df6772
files MoinMoin/script/migration/_conv160_wiki.py MoinMoin/script/migration/_tests/test_conv160_wiki.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/migration/_conv160_wiki.py	Tue Aug 21 14:30:56 2007 +0200
+++ b/MoinMoin/script/migration/_conv160_wiki.py	Tue Aug 21 14:53:12 2007 +0200
@@ -185,8 +185,11 @@
         scheme, url = url.split(':', 1)
         wikiname, pagename = wikiutil.split_wiki(url)
         if (url.startswith(wikiutil.CHILD_PREFIX) or # fancy link to subpage [wiki:/SubPage text]
-            wikiname in ('Self', self.request.cfg.interwikiname, '') or # [wiki:Self:LocalPage text] or [:LocalPage:text]
             Page(self.request, url).exists()): # fancy link to local page [wiki:LocalPage text]
+            pagename = wikiutil.url_unquote(url)
+            pagename = self._replace_target(pagename)
+            return '[[%s%s]]' % (pagename, text)
+        if wikiname in ('Self', self.request.cfg.interwikiname, ''): # [wiki:Self:LocalPage text] or [:LocalPage:text]
             pagename = wikiutil.url_unquote(pagename)
             pagename = self._replace_target(pagename)
             return '[[%s%s]]' % (pagename, text)
--- a/MoinMoin/script/migration/_tests/test_conv160_wiki.py	Tue Aug 21 14:30:56 2007 +0200
+++ b/MoinMoin/script/migration/_tests/test_conv160_wiki.py	Tue Aug 21 14:53:12 2007 +0200
@@ -38,8 +38,6 @@
 
         tests = [
             # FAILING tests:
-            #('[wiki:/OtherPage]', rename_some_page, '[[/OtherPage]]'),
-            #('[wiki:/OtherPage other page]', rename_some_page, '[wiki:/OtherPage other page]'),
 
             # does not work in 1.5.8, no need to convert:
             #('[:MeatBall:CleanLinking meatball-wiki: clean linking]', {}, '[:MeatBall:CleanLinking meatball-wiki: clean linking]'),
@@ -55,6 +53,8 @@
             # does not work in 1.5.8, no need to convert:
             #('[wiki:MacroMarket/EmbedObject EO]', {}, '["MacroMarket/EmbedObject" EO]'),
             ('[wiki:MoinMoin/FrontPage]', {}, '[[MoinMoin:FrontPage]]'),
+            ('[wiki:/OtherPage]', rename_some_page, '[[/OtherPage]]'),
+            ('[wiki:/OtherPage other page]', rename_some_page, '[[/OtherPage|other page]]'),
             ('some_text', {}, 'some_text'),
             ('["some_text"]', {}, '[[some_text]]'),
             ('some_page', rename_some_page, 'some_page'), # not a link