Commits

Thomas Waldmann committed dfef4a0

item-put: rather use the ITEMID, fix exception caused by meta NAME being a list

Comments (0)

Files changed (1)

MoinMoin/script/maint/modify_item.py

 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):
             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,
                   ]
         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)