changeset 903:50aa61c9b952 storage-ng

fixed rename issue: do not use the new name to load the item, but the old one
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 30 Sep 2011 01:00:08 +0200
parents 7b8c2d36a291
children 46263060782e
files MoinMoin/items/__init__.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Thu Sep 29 18:38:05 2011 +0200
+++ b/MoinMoin/items/__init__.py	Fri Sep 30 01:00:08 2011 +0200
@@ -399,7 +399,7 @@
         """
         delete this item by moving it to the trashbin
         """
-        trash_prefix = u'XXTrash/' # XXX move to config
+        trash_prefix = u'Trash/' # XXX move to config
         now = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime())
         # make trash name unique by including timestamp:
         trashname = u'%s%s (%s UTC)' % (trash_prefix, self.name, now)
@@ -459,10 +459,8 @@
         return self._save(meta, data, contenttype_guessed=contenttype_guessed, comment=comment)
 
     def _save(self, meta, data=None, name=None, action=u'SAVE', contenttype_guessed=None, comment=u'', overwrite=False):
-        if name is None:
-            name = self.name
         backend = flaskg.storage
-        storage_item = backend[name]
+        storage_item = backend[self.name]
         try:
             currentrev = storage_item.get_revision(CURRENT)
             rev_no = currentrev.revid
@@ -476,6 +474,8 @@
 
         # we store the previous (if different) and current item name into revision metadata
         # this is useful for rename history and backends that use item uids internally
+        if name is None:
+            name = self.name
         oldname = meta.get(NAME)
         if oldname and oldname != name:
             meta[NAME_OLD] = oldname