view MoinMoin/filter/application_vnd_sun_xml.py @ 1918:bb2e053067fb

fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 27 Mar 2007 21:07:33 +0200
parents 957d482215ac
children 0b220c040be4
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - OpenOffice.org *.sx? Filter

    Depends on: nothing (only python with zlib)

    @copyright: 2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""

import re, zipfile

rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)

def execute(indexobj, filename):
    try:
        zf = zipfile.ZipFile(filename, "r")
        data = zf.read("content.xml")
        zf.close()
        data = " ".join(rx_stripxml.sub(" ", data).split())
    except RuntimeError, err:
        indexobj.request.log(str(err))
        data = ""
    return data.decode('utf-8')