changeset 873:09534d362ed6 storage-ng

remove create_item script, outdated/superceded
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 25 Sep 2011 19:01:23 +0200
parents 135198715129
children 8fa57ebd113e
files MoinMoin/script/__init__.py MoinMoin/script/maint/create_item.py
diffstat 2 files changed, 0 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/__init__.py	Sun Sep 25 18:53:52 2011 +0200
+++ b/MoinMoin/script/__init__.py	Sun Sep 25 19:01:23 2011 +0200
@@ -43,8 +43,6 @@
     manager.add_command("maint_reduce_revisions", Reduce_Revisions())
     from MoinMoin.script.maint.set_meta import Set_Meta
     manager.add_command("maint_set_meta", Set_Meta())
-    from MoinMoin.script.maint.create_item import Create_Item
-    manager.add_command("maint_create_item", Create_Item())
     from MoinMoin.script.maint import modify_item
     manager.add_command("item-get", modify_item.GetItem())
     manager.add_command("item-put", modify_item.PutItem())
--- a/MoinMoin/script/maint/create_item.py	Sun Sep 25 18:53:52 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-# Copyright: 2011 MoinMoin:ReimarBauer
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-    MoinMoin - creates an item
-
-    This script creates a new revision of an item.
-"""
-
-
-from flask import current_app as app
-from flask import g as flaskg
-from flaskext.script import Command, Option
-
-from MoinMoin.config import NAME, ACTION, CONTENTTYPE
-from MoinMoin.storage.error import ItemAlreadyExistsError, NoSuchItemError
-
-
-class Create_Item(Command):
-    description = 'This command can be used to create an item'
-    option_list = (
-        Option('--name', '-n', dest='name', type=unicode, required=True,
-            help='Name of the item to create'),
-        Option('--file', '-f', dest='data_file', type=unicode, required=True,
-            help='Filename of file to read in and store as item.'),
-        Option('--content-type', '-m', dest='contenttype', type=unicode, required=True,
-            help='content-type of item'),
-        Option('--comment', '-c', dest='comment', type=unicode,
-            help='comment for item')
-    )
-
-    def run(self, name, data_file, contenttype, comment):
-        storage = app.unprotected_storage
-        rev_no = -1
-        try:
-            item = storage.create_item(name)
-        except ItemAlreadyExistsError:
-            item = storage.get_item(name)
-            currentrev = item.get_revision(-1)
-            rev_no = currentrev.revno
-        rev = item.create_revision(rev_no + 1)
-        rev[ACTION] = u'SAVE'
-        rev[NAME] = name
-        rev[CONTENTTYPE] = contenttype
-        with open(data_file, 'rb') as data:
-            rev.write(data.read())
-            item.commit()