[Zope-dev] bug: fmt=structured-txt and unicode

Oliver Bleutgen myzope@gmx.net
Mon, 28 Apr 2003 19:28:53 +0200


Hi, when combining localizer and structured text, I found the following 
quirk (Zope 2.6.1):

Rendering an unicode string with
<dtml-var unicodestring fmt=structured-text>

gives an attribute error with meta_type in Module 
DocumentTemplate.DT_Var, line 407, in structured_text.

A quick glance to the source show the following lines to be the cuplrit:

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)

Obviously, this fails.

Workaround: Use <dtml-var "_.str(unicodestring)" fmt=structured-txt">,
works at least for me, though I don't have real exotic unicode strings.

Should I stick it in the collector? I didn't find this error there.

cheers,
oliver