view MoinMoin/action/revert.py @ 3325:b5cc2b8dc753

ignore revert action when not invoked as POST
author Johannes Berg <johannes AT sipsolutions DOT net>
date Wed, 19 Mar 2008 12:06:12 +0100
parents 2a3a6cb34e45
children 2dd4904cfee4
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - revert a page to a previous revision

    @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
                2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""

def execute(pagename, request):
    """ restore another revision of a page as a new current revision """
    from MoinMoin.PageEditor import PageEditor

    if request.request_method != 'POST':
        return

    rev = request.rev
    pg = PageEditor(request, pagename)

    try:
        msg = pg.revertPage(rev)
    except PageEditor.RevertError, error:
        msg = unicode(error)

    request.reset()
    request.theme.add_msg(msg, "dialog")
    pg.send_page()