view MoinMoin/script/maint/modified_systemitems.py @ 1767:54be46b8a0b4

flask ext import change Flask extensions should urge users to import from flask.ext.foo instead of flask_foo or flaskext_foo.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 02 Sep 2012 21:53:25 +0200
parents 2be00a5febbe
children 286e315935ae
line wrap: on
line source
# Copyright: 2004 Nir Soffer <nirs@freeshell.org>
# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
# Copyright: 2011 MoinMoin:ReimarBauer
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
    MoinMoin - list system items that has been edited in this wiki.

"""


from flask import current_app as app
from flask.ext.script import Command

from MoinMoin.config import IS_SYSITEM, SYSITEM_VERSION

class Modified_SystemItems(Command):
    description = 'This command can be used to list system items that has been edited in this wiki.'

    def run(self):
        edited_sys_items = []
        for current_rev in app.storage.documents():
            is_sysitem = current_rev.meta.get(IS_SYSITEM, False)
            if is_sysitem:
                version = current_rev.meta.get(SYSITEM_VERSION)
                if version is None:
                    # if we don't have the version, it was edited:
                    edited_sys_items.append(item.name)

        # Format as numbered list, sorted by item name
        edited_sys_items.sort()
        if edited_sys_items:
            print "Edited system items:"
            for item_name in edited_sys_items:
                print item_name
        else:
            print "Not any modified system items found!"