[Grok-dev] thoughts while writing a tutorial
Darryl Cousins
darryl at darrylcousins.net.nz
Thu Aug 23 07:57:29 EDT 2007
Hi,
On Wed, 2007-08-22 at 10:38 -0400, Brandon Craig Rhodes wrote:
> Darryl, thank you for the guidance on getting "grok2html" to find and
> process my tutorial! I can now see what tutorial looks like rendered.
>
> I am about halfway done, but have run into a problem: adding a Unicode
> character to my tutorial results in an exception, and I cannot quite
> determine what's wrong. It looks like the file gets read as Unicode,
> and begins to be processed as Unicode; but somewhere, once it reaches
> the Zope template library, something tries applying 'ascii' to it:
Yes, this is a bug in the grok2html script. A year ago I was using
`identical` code to render rest text fils to html using zpt's and had
unicode rendering well when reading the file with codecs. I have tried
to remedy the problem in the current grok2html script but failed. I
think the solution lies in the class ReStructuredTextToHTMLRenderer,
particularly the `render` method. Perhaps a dig in ZopeTranslator would
show up a solution.
Sorry I can't be more helpful at the moment.
Best regards,
Darryl
>
> Traceback (most recent call last):
> File "/home/brandon/projects/grok/grok/bin/grok2html", line 75, in <module>
> grok2html.main()
> File "/home/brandon/projects/grok/grok/doc/grok2html.py", line 188, in main
> create_html(rest_files, template)
> File "/home/brandon/projects/grok/grok/doc/grok2html.py", line 132, in create_html
> restfile.create_html(page, settings)
> File "/home/brandon/projects/grok/grok/doc/grok2html.py", line 92, in create_html
> content = page.pt_render(namespace=settings)
> File "/home/brandon/projects/grok/grok/eggs/tmp68sMaw/zope.pagetemplate-3.4.0a1-py2.5.egg/zope/pagetemplate/pagetemplate.py", line 115, in pt_render
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 271, in __call__
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 346, in interpret
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 891, in do_useMacro
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 346, in interpret
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 536, in do_optTag_tal
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 521, in do_optTag
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 516, in no_tag
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 346, in interpret
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 534, in do_optTag_tal
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 516, in no_tag
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 346, in interpret
> File "/home/brandon/projects/grok/grok/eggs/tmpjGfPni/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py", line 754, in do_insertStructure_tal
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2258: ordinal not in range(128)
>
More information about the Grok-dev
mailing list