view MoinMoin/filter/ @ 5928:d97e3b0d6b49

reorder input fields in recoverpass form, to help browsers remember the user name (not the recovery token)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 21 Jan 2013 16:24:06 +0100
parents b2e96d4cac1c
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - *.sx? Filter

    Depends on: nothing (only python with zlib)

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

import re, zipfile

from MoinMoin import log
logging = log.getLogger(__name__)

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

def execute(indexobj, filename):
        zf = zipfile.ZipFile(filename, "r")
        data ="content.xml")
        data = " ".join(rx_stripxml.sub(" ", data).split())
    except (zipfile.BadZipfile, RuntimeError), err:
        logging.error("%s [%s]" % (str(err), filename))
        data = ""
        data = data.decode('utf-8')
    except UnicodeDecodeError:
        # protected with password? no valid OpenOffice file?
        data = u''
    return data