Description

The evaluation used in line 154 of parser/rst.py of MoinMoin 1.5.0 compares a tuple against a list:

        required_version = (0, 3, 10)
        current_version = [int(i) for i in docutils.__version__.split('.')]
        if current_version < required_version:

This comparison is meaningless in Python, but unfortunately it does not (yet, see Comparing heterogeneous types) raise an exception, and always results in a false value, rendering Docutils support unusable.

Steps to reproduce

  1. Make sure you have Docutils > 0.3.10 (e.g. 0.4) globally available in your system.

  2. Start creating a new page, write #format rst on the top and add some text.

  3. Click on the preview button.

The following RuntimeError is shown:

ERROR: The installed docutils version is 0.4; version 0.3.10 or later is required.

Details

MoinMoin Version

1.5.0

OS and Version

Debian Sarge

Python Version

2.3.5

Server Setup

Local installation of MoinMoin and Docutils 0.4

Workaround

The appropriate way to fix this is converting the list current_version into a tuple, so that the comparison makes sense:

        required_version = (0, 3, 10)
        current_version = tuple([int(i) for i in docutils.__version__.split('.')])
        if current_version < required_version:

Discussion

Some comparisons between disparate Python objects return meaningless results. Have a look at Comparing heterogeneous types and PEP 3000 (under “Core language”).

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/BrokenDocutilsVersionComparison (last edited 2009-01-25 16:23:42 by DennisBenzinger)