view data/plugin/xmlrpc/ @ 529:db71033db140

xmlrpc.getPackage: This plugin gets a page and all its attachments as MoinMoin Package file.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 21 May 2010 19:12:49 +0200
children 127da830be6c
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - get a page with attachments as MoinMoin Package

    @copyright: 2010 MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.
import cStringIO
from MoinMoin import wikiutil
from MoinMoin.action.PackagePages import PackagePages
from MoinMoin.packages import unpackLine

def execute(xmlrpcobj, pagename, include_attachments = True):
    gets a Package from a page(s) with all attachments
    @param pagename: name of page(s)
    @param include_attachments: with attachments
    request = xmlrpcobj.request
    pagelist = pagename
    packagename = "" % pagename
    target = wikiutil.taintfilename(packagename)
    filelike = cStringIO.StringIO()
    package = PackagePages(pagename, request).collectpackage(unpackLine(pagelist, ","), filelike, target, include_attachments)
    return xmlrpcobj._outlob(filelike.getvalue())