[ZCM] [ZC] 1426/ 3 Comment "System locale breaks reStructuredText
horribly"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Wed Jul 21 07:04:35 EDT 2004
Issue #1426 Update (Comment) "System locale breaks reStructuredText horribly"
Status Pending, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/1426
==============================================================
= Comment - Entry #3 by mgedmin on Jul 21, 2004 7:04 am
I should probably mention that I encountered this problem while trying to
use reStructuredText pages in ZWiki 0.32.0. I am not sure if it matters,
but the symptoms may be different when using <dtml-var
fmt="restructured-text">.
I completely agree that that it is docutils' fault that error reporting is
obfuscated. Do you know where I should submit the docutils bug report?
The sourceforge bug tracker for the docutils project is suspiciously empty
-- is it used at all?
On the other hand Zope in general and the reStructuredText product should
at least enable the 'traceback' Docutils setting to prevent docutils from
calling sys.exit.
Also, what do you think about my proposed 'rest-language-code' setting?
________________________________________
= Comment - Entry #2 by ajung on Jul 21, 2004 12:38 am
This problem is more related to docutils and to Zope since we don't maintain the docutils code and we use it without
modifications. So please report this issue to the docutils
people. But some observations from my side:
If you set LC_CTYPE=xxx.xxx then Zope performs an exit
because docutils tries loading the module "xxx" (could not find out where and why). If you set LC_TYPE=xxx then
<dtml-var text fmt="restructured-text"> complains first
about the unknown locale:xxx and then it raises an ImportError for the HTML module.
________________________________________
= Request - Entry #1 by mgedmin on Jul 20, 2004 3:40 pm
On my system LANG is set to "C" and LC_CTYPE is set to "lt_LT.UTF-8". For some reason reStructuredText from Zope 2.7.1 decides to use 'lt' as the default language (see lib/python/reStructuredText/__init__.py). This, in turn, causes an ImportError in
Module docutils.core, line 439, in publish_parts
Module docutils.core, line 181, in publish
Module docutils.core, line 159, in apply_transforms
Module docutils.transforms, line 179, in apply_transforms
Module docutils.transforms, line 59, in __init__
Module docutils.languages, line 21, in get_language
The ImportError is caught in docutils.core.publish and a SystemExit is raised instead, obscuring the issue further.
As a temporary workaround I added the following line to my runzope script:
export LC_CTYPE=C
I think there are at least two things that need to be fixed:
- The language used for ReStructuredText should be configurable
independently from system locale (please add 'rest-language-code' to
zope.conf)
- A significantly better error indication is needed when a language code
is not supported by docutils (and in other instances as well). Simply
performing sys.exit is unacceptable. Also, the error indication printed
to sys.stderr did not appear in my event.log file when I used zopectl
to run Zope in the background.
==============================================================
More information about the Zope-Collector-Monitor
mailing list