From: David Abrahams <dave@bo...> - 2008-03-18 20:58:30
The subject line refers to code like this, from html4css1/__init__.py:
supported = ('html', 'html4css1', 'xhtml')
"""Formats this writer supports."""
default_stylesheet = 'html4css1.css'
default_stylesheet_path = utils.relative_path(
default_template = 'template.txt'
Note that these paths are computed when html4css1 is loaded. I ran
into a really weird problem as I was upgrading
http://boostcon.com, that wasn't reflected on my development server for
reasons that are semi-analyzed in the comment below
# Attempt to account for relative path differences to stylesheets and
# templates on installed system. ***This is a HACK***.
# Because the paths of the cwd and the default stylesheet and
# template.txt on our live server have something in common, Python
# calculates a relative path between them (see html4css1.Writer's
# class-level initializations). It's not clear why this should cause
# those stylesheets not to be found, but in fact it does. Perhaps the
# cwd gets changed later, I don't know. On my development system we
# have no path elements in common and thus we end up with an absolute
# path, and the stylesheet and template are always found.
_save_cwd = os.getcwd()
from docutils.writers import html4css1
As you can see, I haven't been able to fully understand the issue -- I
had to get the site back up and running in a hurry. I'm not sure
whether there's something I ought to be doing differently, but computing
these relative paths, without turning them into absolute paths, at the
moment the module is loaded, seems like a recipe for this sort of
My goal in this case is to use the default stylesheet and templates,
thus when I initialize my subclass of html4css1.Writer, I'm not doing
anything fancy to override those settings.
I hope someone can shed some light here, so TIA.