Attachment 'sxw.py'

Download

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

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-02-13 12:15:36, 0.7 KB) [[attachment:binary.py]]
  • [get | view] (2006-02-13 12:15:37, 0.6 KB) [[attachment:sxw.py]]
  • [get | view] (2006-02-13 12:15:38, 0.7 KB) [[attachment:txt.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.