view MoinMoin/action/ @ 1529:76b4d2324d25

MoinMoin should not record the homepage links as pagelinks, fixes MoinMoinBugs/PageLinksIncludeUnrelatedLinks.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Tue, 05 Sep 2006 00:29:59 +0200
parents abe498212fb8
children 30116d7d098a
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - revert a page to a previous revision

    @copyright: 2000-2004 by Jürgen Hermann <>,
                2006 by 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
    _ = request.getText

    if not request.user.may.revert(pagename):
        return Page(request, pagename).send_page(request,
            msg=_('You are not allowed to revert this page!'))

    rev = int(request.form['rev'][0])
    revstr = '%08d' % rev
    oldpg = Page(request, pagename, rev=rev)
    pg = PageEditor(request, pagename)

        savemsg = pg.saveText(oldpg.get_raw_body(), 0, extra=revstr,
    except pg.SaveError, msg:
        # msg contain a unicode string
        savemsg = unicode(msg)
    pg.send_page(request, msg=savemsg)