Description

MoinMoin version: 1.7.1 Linux version: Ubuntu 8.04.1 Hardy

When trying to render a DocBook, python fails to import xml.dom.ext.reader in file text_docbook.py because it cant find PyXML. PyXML is now installed under /usr/lib/python-2.5/site-packages/oldxml/_xmlplus. This directory is not in the python search path. Hence, the /usr/lib/python-2.5/xml/init.py that tries to check if PyXML is installed and prefer it over the built-in xml packages will not find it.

error message ( this is for search engine to find this bug)

No module named ext.reader

* args = ('No module named ext.reader',) * message = 'No module named ext.reader'

add the PyXML path in your moin.cgi file

sys.path.insert(0,'/usr/lib/python2.5/site-packages/oldxml')

Please add traceback.html.

Steps to reproduce

  1. do this...

Example

Component selection

Details

MoinMoin Version 1.71

OS and Version Ubuntu 8.04.1

Python Version 2.5.2

Server Setup

Server Details

Language you are using the wiki in (en)

Workaround

Discussion

This doesn't look like a moin bug, but rather like a Python XML problem.

AFAIK, you don't need to install PyXML when using Python 2.5, the builtin xml stuff in 2.5 (which basically is an integrated PyXML) should be enough for moin.

If you still think it is a moin bug, please provide more information about it and reopen the bug.

Update from Peter Maas, Aachen, 2009-03-01, using MoinMoin 1.8.2:

I experienced this failure under Windows XP. There is no oldxml directory in the Windows Python installation, neither in 2.5 nor 2.6. I was able to fix the bug by installing PyXML 0.8.4 under Python 2.5. But under Python 2.6 PyXML no longer works because it uses variables named "as" which is a keyword in 2.6. I wonder wether it is possible to support docbook export with the xml packages of the standard library. PyXML development has stopped 5 years ago and it is not advisable to let a regular MoinMoin feature depend on abandoned code.

Fix?

I changed the docbook formatter to not depend on 4suite and PyXML. I don't have much clue about Python XML stuff, so I need some people testing this and looking at the patch (the patch applies to moin 1.7/1.8/1.9): formatter_text_docbook_minidom.patch

It SEEMS to work with minidom, but if it works with stdlib minidom, why was it implemented with 4suite "4DOM" at first? I have no idea...

Please test with:

Patch Test Results (please give moin and python version and whether you have PyXML installed):

1. Feedback

moin.log:
MoinMoin.failure ERROR An exception occurred, URI was "/Aktuelle%C3%84nderungen?action=show&mimetype=text/docbook".
Traceback (most recent call last):
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/request/__init__.py", line 1311, in run
    handler(self.page.page_name, self)
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/action/__init__.py", line 253, in do_show
    content_only=content_only,
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/Page.py", line 1201, in send_page
    start_line=pi['lines'])
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/Page.py", line 1285, in send_page_content
    self.format(parser)
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/Page.py", line 1306, in format
    parser.format(self.formatter)
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1546, in format
    formatted_line = self.scan(line, inhibit_p=inhibit_p)
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1360, in scan
    result.append(self.replace(match, inhibit_p))
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1404, in replace
    result.append(replace_func(hit, match.groupdict()))
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1327, in _macro_repl
    return self.formatter.macro(self.macro, macro_name, macro_args, markup=groups.get('macro'))
  File "/opt/moin/lib/python2.6/site-packages/MoinMoin/formatter/text_docbook.py", line 610, in macro
    xml_dom = minidom.parseString(text).documentElement.childNodes
  File "/opt/webstack/python/lib/python2.6/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/opt/webstack/python/lib/python2.6/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/opt/webstack/python/lib/python2.6/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 3246: ordinal not in range(128)
2009-08-10 11:27:04,054 MoinMoin.log WARNING /opt/moin/lib/python2.6/site-packages/MoinMoin/support/cgitb.py:483: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

feedback 2

The patch seems to work. (MoinMoin 1.9 with python 2.7.2 on linux) And there is no problem with international characters (tested with Korean characters). Is there a plan to merge it in 1.9 branch? -- SixMen 2012-02-08 04:31:10

And I think that this additional patch will help.

   1 diff -uNr MoinMoin.orig//Page.py MoinMoin/Page.py
   2 --- MoinMoin.orig//Page.py      2010-06-27 06:46:40.000000000 +0900
   3 +++ MoinMoin/Page.py    2012-02-08 12:55:08.576298506 +0900
   4 @@ -1079,7 +1079,10 @@
   5          page_exists = self.exists()
   6          if not content_only:
   7              if emit_headers:
   8 -                request.content_type = "%s; charset=%s" % (self.output_mimetype, self.output_charset)
   9 +                if self.output_mimetype=='text/docbook':
  10 +                    request.content_type = "%s; charset=%s" % ('text/xml', self.output_charset)
  11 +                else:
  12 +                    request.content_type = "%s; charset=%s" % (self.output_mimetype, self.output_charset)
  13                  if page_exists:
  14                      if not request.user.may.read(self.page_name):
  15                          request.status_code = 403
  16 diff -uNr MoinMoin.orig//config/multiconfig.py MoinMoin/config/multiconfig.py
  17 --- MoinMoin.orig//config/multiconfig.py        2010-06-27 06:46:41.000000000 +0900
  18 +++ MoinMoin/config/multiconfig.py      2012-02-08 11:54:38.237430625 +0900
  19 @@ -332,14 +332,6 @@
  20              except ImportError:
  21                  self.chart_options = None
  22 
  23 -        # "Render As Docbook" requires python-xml.
  24 -        if 'RenderAsDocbook' not in self.actions_excluded:
  25 -            try:
  26 -                from xml.dom.ext.reader import Sax
  27 -            except ImportError:
  28 -                # this will also remove it from the actions menu:
  29 -                self.actions_excluded.append('RenderAsDocbook')
  30 -
  31          # 'setuid' special auth method auth method can log out
  32          self.auth_can_logout = ['setuid']
  33          self.auth_login_inputs = []

SixMen, thanks for the patch. Of course the check in multiconfig also needed removal. As the correct mimetype for docbook is not quite clear, i kept that part as it was, though. -- ThomasWaldmann 2012-09-16 21:28:17

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/OldXMLPathIsMissing (last edited 2012-09-16 21:28:18 by ThomasWaldmann)