changeset 1040:97170e8d69e5 namespaces

page can be fetched by any of its name
author Luis Henrique Fagundes <lhfagundes@gmail.com>
date Mon, 31 Oct 2011 02:30:04 -0200
parents b521a6667a54
children 1d3e8fb4a7a8
files MoinMoin/items/_tests/test_Item.py MoinMoin/storage/middleware/indexing.py MoinMoin/storage/middleware/routing.py
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/_tests/test_Item.py	Mon Oct 31 01:42:27 2011 -0200
+++ b/MoinMoin/items/_tests/test_Item.py	Mon Oct 31 02:30:04 2011 -0200
@@ -274,19 +274,19 @@
         # item at new name and its contents after renaming
         item = Item.create(u'Renamed_Page')
         assert item.name == u'Renamed_Page'
-        assert item.meta['name_old'] == u'Page'
+        assert item.meta['name_old'] == [u'Page']
         assert item.meta['comment'] == u'renamed'
         assert item.data == u'Page 1'
 
         item = Item.create(u'Renamed_Page/Child')
         assert item.name == u'Renamed_Page/Child'
-        assert item.meta['name_old'] == u'Page/Child'
+        assert item.meta['name_old'] == [u'Page/Child']
         assert item.meta['comment'] == u'renamed'
         assert item.data == u'this is child'
 
         item = Item.create(u'Renamed_Page/Child/Another')
         assert item.name == u'Renamed_Page/Child/Another'
-        assert item.meta['name_old'] == u'Page/Child/Another'
+        assert item.meta['name_old'] == [u'Page/Child/Another']
         assert item.meta['comment'] == u'renamed'
         assert item.data == u'another child'
 
--- a/MoinMoin/storage/middleware/indexing.py	Mon Oct 31 01:42:27 2011 -0200
+++ b/MoinMoin/storage/middleware/indexing.py	Mon Oct 31 02:30:04 2011 -0200
@@ -883,7 +883,10 @@
         return name
 
     def _load(self):
-        meta, data = self.backend.retrieve(self._doc[NAME], self.revid) # raises KeyError if rev does not exist
+        name = self._doc[NAME]
+        if type(name) is types.ListType:
+            name = name[0]
+        meta, data = self.backend.retrieve(name, self.revid) # raises KeyError if rev does not exist
         self.meta = Meta(self, self._doc, meta)
         self._data = data
         return meta, data
--- a/MoinMoin/storage/middleware/routing.py	Mon Oct 31 01:42:27 2011 -0200
+++ b/MoinMoin/storage/middleware/routing.py	Mon Oct 31 02:30:04 2011 -0200
@@ -109,9 +109,9 @@
         backend, itemname, mountpoint = self._get_backend(mountpoint_itemname)
         if not isinstance(backend, MutableBackendBase):
             raise TypeError('backend {0!r} mounted at {1!r} is readonly'.format(backend, mountpoint))
-        meta[NAME] = itemname
+        #meta[NAME] = itemname
         revid = backend.store(meta, data)
-        meta[NAME] = mountpoint_itemname # restore the original name
+        #meta[NAME] = mountpoint_itemname # restore the original name
         return revid
 
     def remove(self, name, revid):