~ubuntu-branches/ubuntu/intrepid/moin/intrepid-updates

« back to all changes in this revision

Viewing changes to MoinMoin/filter/application_vnd_sun_xml.py

  • Committer: Bazaar Package Importer
  • Author(s): Sivan Greenberg
  • Date: 2006-07-09 19:28:02 UTC
  • Revision ID: james.westby@ubuntu.com-20060709192802-oaeuvt4v3e9300uj
Tags: 1.5.3-1ubuntu1
* Merge new debian version.
* Reapply Ubuntu changes:
    + debian/rules:
      - Comment out usage of control.ubuntu.in (doesn't fit!).
    + debian/control.in:
      - Dropped python2.3 binary package.
    + debian/control:
      - Dropped python2.3 binary, again.
      - Dropped python2.3-dev from Build-Depends-Indep.
    + debian/patches/001-attachment-xss-fix.patch:
      - Dropped this patch. It's now in upstream's distribution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: iso-8859-1 -*-
 
2
"""
 
3
    MoinMoin - OpenOffice.org *.sx? Filter
 
4
 
 
5
    Depends on: nothing (only python with zlib)
 
6
 
 
7
    @copyright: 2006 by ThomasWaldmann MoinMoin:ThomasWaldmann
 
8
    @license: GNU GPL, see COPYING for details.
 
9
"""
 
10
 
 
11
import re, zipfile
 
12
 
 
13
rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)
 
14
 
 
15
def execute(indexobj, filename):
 
16
    try:
 
17
        zf = zipfile.ZipFile(filename, "r")
 
18
        data = zf.read("content.xml")
 
19
        zf.close()
 
20
        data = " ".join(rx_stripxml.sub(" ", data).split())
 
21
    except RuntimeError, err:
 
22
        indexobj.request.log(str(err))
 
23
        data = ""
 
24
    return data.decode('utf-8')
 
25