view MoinMoin/action/revert.py @ 3027:6dcc9617bab6

Fix for WrongAlignedAttachment (Thanks to Benjamin Weber) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 03 Feb 2008 17:57:42 +0100
parents ba14d391c2ba
children 2a3a6cb34e45
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.
"""
from MoinMoin.Page import Page

def execute(pagename, request):
    """ restore another revision of a page as a new current revision """
    from MoinMoin.PageEditor import PageEditor
    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()