changeset 1950:dfef4a080377 namespaces

item-put: rather use the ITEMID, fix exception caused by meta NAME being a list
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 05 Feb 2013 12:50:07 +0100
parents b751a12e8239
children 68ca17889385
files MoinMoin/script/maint/modify_item.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/modify_item.py	Tue Feb 05 01:17:46 2013 +0100
+++ b/MoinMoin/script/maint/modify_item.py	Tue Feb 05 12:50:07 2013 +0100
@@ -12,7 +12,7 @@
 from flask import g as flaskg
 from flask.ext.script import Command, Option
 
-from MoinMoin.config import NAME, CURRENT, REVID, DATAID, SIZE, HASH_ALGORITHM
+from MoinMoin.config import CURRENT, ITEMID, REVID, DATAID, SIZE, HASH_ALGORITHM
 
 
 class GetItem(Command):
@@ -55,7 +55,6 @@
             meta = mf.read()
         meta = meta.decode('utf-8')
         meta = json.loads(meta)
-        name = meta[NAME]
         to_kill = [SIZE, HASH_ALGORITHM, # gets re-computed automatically
                    DATAID,
                   ]
@@ -64,6 +63,7 @@
         if not overwrite:
             # if we remove the REVID, it will create a new one and store under the new one
             meta.pop(REVID, None)
-        item = app.storage[name]
+        query = {ITEMID: meta[ITEMID]}
+        item = app.storage.get_item(**query)
         with open(data_file, 'rb') as df:
             item.store_revision(meta, df, overwrite=overwrite)