[Cubicweb] docutils broken with CubicWeb

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Thu Apr 7 12:39:33 CEST 2016

Directly changing docutils/writers/html4css1/__init__.py from:
    default_stylesheet_path = utils.relative_path(
        os.path.join(os.getcwd(), 'dummy'),
        os.path.join(os.path.dirname(__file__), default_stylesheet))
    default_template_path = utils.relative_path(
        os.path.join(os.getcwd(), 'dummy'),
        os.path.join(os.path.dirname(__file__), default_template))
    default_stylesheet_path = os.path.join(
        os.path.dirname(__file__), default_stylesheet)
    default_template_path = os.path.join(
        os.path.dirname(__file__), default_template)
does fix the bug.

Any clue where I should be trying to mokey patch this code from? Monkey
patching from the hooks.py file of our cube doesn't seem to be working.

Best wishes,

Le 07/04/2016 12:00, Dimitri Papadopoulos Orfanos a écrit :
> Doesn't work when resetting "default_stylesheet_path" from within
> site_cubicweb.py either.
> Perhaps there are some CubicWeb functions I should monkey patch.
> There might be other global variables initialized in docutils using the
> initial value of "default_stylesheet_path". I should probably reset
> these variables too. But how to find which global variables need to be
> reset?
> Best,
> Dimitri
> Le 07/04/2016 11:44, Dimitri Papadopoulos Orfanos a écrit :
>> 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(
>>     os.path.dirname(docutils.writers.html4css1.__file__),
>>     docutils.writers.html4css1.Writer.default_stylesheet)
>> docutils.writers.html4css1.Writer.default_template_path = os.path.join(
>>     os.path.dirname(docutils.writers.html4css1.__file__),
>>     docutils.writers.html4css1.Writer.default_template)
>> ### 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?
>> Best,
>> Dimitri

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

More information about the Cubicweb mailing list