Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.filter.application_vnd_oasis_opendocument Namespace Reference

Functions

def execute

Variables

tuple logging = log.getLogger(__name__)
tuple rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)

Function Documentation

Definition at line 18 of file application_vnd_oasis_opendocument.py.

00018 
00019 def execute(indexobj, filename):
00020     try:
00021         zf = zipfile.ZipFile(filename, "r")
00022         data = zf.read("content.xml")
00023         zf.close()
00024         data = " ".join(rx_stripxml.sub(" ", data).split())
00025     except (zipfile.BadZipfile, RuntimeError), err:
00026         logging.error("%s [%s]" % (str(err), filename))
00027         data = ""
00028     try:
00029         data = data.decode('utf-8')
00030     except UnicodeDecodeError:
00031         # protected with password? no valid OpenDocument file?
00032         data = u''
00033     return data
00034 

Variable Documentation

Definition at line 14 of file application_vnd_oasis_opendocument.py.

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

Definition at line 16 of file application_vnd_oasis_opendocument.py.