view data/plugin/xmlrpc/getPackage.py @ 653:127da830be6c

updated copyright
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 19 Apr 2016 16:29:54 +0200
parents db71033db140
children
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - get a page with attachments as MoinMoin Package

    @copyright: 2010-2016 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 = "%s.zip" % pagename
    target = wikiutil.taintfilename(packagename)
    filelike = cStringIO.StringIO()
    package = PackagePages(pagename, request).collectpackage(unpackLine(pagelist, ","), filelike, target, include_attachments)
    return xmlrpcobj._outlob(filelike.getvalue())