[ZCM] [ZC] 1762/ 9 Comment "Restructured Text unicode problem"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Sat May 7 07:44:49 EDT 2005
Issue #1762 Update (Comment) "Restructured Text unicode problem"
Status Rejected, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/1762
==============================================================
= Comment - Entry #9 by efge on May 7, 2005 7:44 am
str() returning the source (and HTML-quoted at that) and not the formatted output is not intuitive at all and not coherent with other text-bearing documents. It can be considered a design bug.
Alas, it's too late to change it.
________________________________________
= Comment - Entry #8 by ajung on May 6, 2005 7:34 am
ZReST has been designed for *standalone* restructured-text content
and *not* to be included within other content.
Since <dtml-var doc> calls the str() method of the content object and ZReST.str() returns the source you will get the sources. So
your approach is wrong. If you don't want to fix your usecase
then use the following:
<dtml-var "doc.formatted" >
________________________________________
= Comment - Entry #7 by garanin on May 5, 2005 1:23 pm
I not agree.
1) <dtml-var zzz> => print source of zzz
2) <dtml-var zzz fmt="restructured-text"> => work for zzz with ascii content
________________________________________
= Reject - Entry #6 by ajung on May 5, 2005 6:14 am
Status: Accepted => Rejected
<dtml-var zzz fmt="restructured-text">
This makes absolutely no sense if zzz is *already* an instance
of RestructuredDocument.
<dtml-var zzz> is in this case sufficient since 'zzz'
*automatically* renders the reST content as HTML and there is no need to transform the HTML against through reST.
________________________________________
= Comment - Entry #5 by garanin on May 4, 2005 1:50 pm
Sorry, i mistake in previous message.
I have not problem with ZReST, i have problem with restructured_text function for unicode text:
1) add ReStructureText Document from ZMI with id == zzz
2) set input\output encoding = utf-8
3) edit new document: i write russian text UTF-8 (ÑÑа)
4) save document & view => OK
5) now, i want use ReST inside dtml accord doc/RESTRUCTUREDSTEXT.txt
6) create dtml-method with content: <dtml-var zzz fmt="restructured-text"> and save
7) view dtml-method => UnicodeEncodeError
(sorry, i dont know how get *full traceback*)
________________________________________
= Assign - Entry #4 by ajung on May 3, 2005 1:01 am
Status: Pending => Accepted
Supporters added: ajung
RestructuredText documents have dedicated properties for input and output-encoding
which must be set properly. Please verify if this is the case for you.
And please provide a **full traceback** if you want to have this fixed.
________________________________________
= Comment - Entry #3 by garanin on Apr 29, 2005 5:27 pm
Details:
1) add ReStructureText Document from ZMI
2) edit new document: i write russian text UTF-8 (ÑÑа)
3) try save document => Error Type: UnicodeEncodeError
Error Value: 'ascii' codec can't encode characters in position 507-509: ordinal not in range(128)
________________________________________
= Comment - Entry #2 by ajung on Apr 29, 2005 6:05 am
Please describe how to provoke a Unicode error.
________________________________________
= Request - Entry #1 by garanin on Apr 22, 2005 5:58 pm
DocumentTemplate/DT_Var/restructured_text not work with unicode :
def restructured_text(v, name='(Unknown name)', md={}):
from reStructuredText import HTML
if isinstance(v,StringType): txt = v
elif aq_base(v).meta_type in ['DTML Document','DTML Method']:
txt = aq_base(v).read_raw()
else: txt = str(v) <========================== error for UnicodeType
return HTML(txt)
==============================================================
More information about the Zope-Collector-Monitor
mailing list