diff MoinMoin/items/__init__.py @ 1042:e666253e7d0d namespaces

pages with multiple names are properly renamed
author Luis Henrique Fagundes <lhfagundes@gmail.com>
date Mon, 31 Oct 2011 03:59:02 -0200
parents b521a6667a54
children 97f917f7c8ba
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Mon Oct 31 02:31:59 2011 -0200
+++ b/MoinMoin/items/__init__.py	Mon Oct 31 03:59:02 2011 -0200
@@ -20,6 +20,7 @@
 import zipfile
 import tempfile
 import itertools
+import types
 from StringIO import StringIO
 from array import array
 
@@ -469,9 +470,19 @@
         if name is None:
             name = self.name
         oldname = meta.get(NAME)
-        if oldname and oldname != name:
-            meta[NAME_OLD] = oldname
-        meta[NAME] = name
+        if oldname:
+            if type(oldname) is not types.ListType:
+                oldname = [oldname]
+            if name not in oldname: #this is a rename
+                meta[NAME_OLD] = oldname[:]
+                try:
+                    oldname.remove(self.name)
+                except ValueError:
+                    pass
+                oldname.append(name)
+                meta[NAME] = oldname
+        else:
+            meta[NAME] = [name]
 
         if comment:
             meta[COMMENT] = unicode(comment)