changeset 2747:bb686d95f113

1.6 converter: fixed relative links
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 21 Aug 2007 23:11:26 +0200
parents b7b48f70ced4
children d28a4f5d0003
files MoinMoin/script/migration/_conv160_wiki.py MoinMoin/script/migration/_tests/test_conv160_wiki.py
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/migration/_conv160_wiki.py	Tue Aug 21 22:57:14 2007 +0200
+++ b/MoinMoin/script/migration/_conv160_wiki.py	Tue Aug 21 23:11:26 2007 +0200
@@ -111,8 +111,9 @@
             item_name = file_name
             key = (item_type, abs_page_name, file_name)
         new_name = self.renames.get(key, item_name)
-        if new_name != item_name and abs_page_name != page_name:
-            pass # TODO we have to fix the (absolute) new_name to be a relative name (as it was before)
+        if item_type == 'PAGE' and new_name != item_name and abs_page_name != page_name:
+            # we have to fix the (absolute) new_name to be a relative name (as it was before)
+            new_name = wikiutil.RelPageName(current_page, new_name)
         return new_name
 
     def _replace_target(self, target):
--- a/MoinMoin/script/migration/_tests/test_conv160_wiki.py	Tue Aug 21 22:57:14 2007 +0200
+++ b/MoinMoin/script/migration/_tests/test_conv160_wiki.py	Tue Aug 21 23:11:26 2007 +0200
@@ -38,7 +38,6 @@
 
         tests = [
             # FAILING tests:
-
             # does not work in 1.5.8, no need to convert:
             #('[:MeatBall:CleanLinking meatball-wiki: clean linking]', {}, '[:MeatBall:CleanLinking meatball-wiki: clean linking]'),
 
@@ -128,8 +127,7 @@
             ('["../sister_norename"]', rename_some_page, '[[../sister_norename]]'),
 
             # renames
-            # FAILS, see TODO in _replace:
-            #('["../sister"]', rename_some_page, '["../renamed_sister"]'),
+            ('["../sister"]', rename_some_page, '[[../renamed_sister]]'),
         ]
         for data, renames, expected in tests:
             assert convert_wiki(request, pagename, data, renames) == expected
@@ -145,8 +143,7 @@
             ('["/subpage_norename"]', rename_some_page, '[[/subpage_norename]]'),
 
             # renames
-            # FAILS, see TODO in _replace:
-            #('["/subpage"]', rename_some_page, '["/renamed_subpage"]'),
+            ('["/subpage"]', rename_some_page, '[[/renamed_subpage]]'),
         ]
         for data, renames, expected in tests:
             assert convert_wiki(request, pagename, data, renames) == expected