[Cubicweb] docutils broken with CubicWeb

Denis Laxalde denis.laxalde at logilab.fr
Thu Apr 7 13:56:53 CEST 2016


Dimitri Papadopoulos Orfanos a écrit :
> 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))
> to:
>      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.

I just tried:

site_cubicweb.py:

import os.path
from docutils.writers import html4css1

html4css1.Writer.default_template_path = os.path.join(
     os.path.dirname(html4css1.__file__), html4css1.Writer.default_template)

and then in, e.g., entities.py:

from cubicweb.ext.html4zope import CSS1Writer
print(CSS1Writer.default_template_path)


gives me the "monkeypatched" value (cubicweb.ext.html4zopeis the only 
place in cubicweb where I found the doctutils module at stake).

-- 
Denis Laxalde
Logilab         http://www.logilab.fr



More information about the Cubicweb mailing list