[Cubicweb] docutils broken with CubicWeb

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Thu Apr 7 11:44:11 CEST 2016

Hi Denis,

Since reload() does not seem to be working (at least not without looking
into Python internals) I have been trying this in our code, just before
using docutils:

import docutils.writers.html4css1
docutils.writers.html4css1.Writer.default_stylesheet_path = os.path.join(
docutils.writers.html4css1.Writer.default_template_path = os.path.join(

### this used to be the 1st docutils import in our code
from docutils.core import publish_parts

Not working either! I'm starting to wonder whether docutils is used
elsewhere as well, after os.chdir('/') but outside our application.
Couldn't find anything so far.

Just to make sure: is site_cubicweb.py a better choice because it is
called much earlier?


Le 07/04/2016 11:31, Denis Laxalde a écrit :
> Hi Dimitri,
> Dimitri Papadopoulos Orfanos a écrit :
>> This bug has been recently fixed in docutils:
>>     https://sourceforge.net/p/docutils/code/7795/
>> Unfortunately it's not part of any formal release yet, so we're stuck
>> with it in the short term. Any clue how to best work around this issue
>> with minimal code modification? I would like to avoid modifying CubicWeb
>> (deferring imports maybe) or docutils (killing the ugly relative_path()
>> function wherever it's used with os.getcwd()).
>> => How would you work around this from within a CubicWeb application?
> I would add a couple of monkeypatches following the patch you linked
> above in site_cubicweb.py of the main cube waiting for a release of
> docutils fixing this.

Dimitri Papadopoulos
DRF, I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France

More information about the Cubicweb mailing list