Plone 4.1, Dexterity 1.0.1<br>I have a Dexterity content-type with plone.app.content.interfaces.INameFromTitle and plone.app.dexterity.behaviors.metadata.IBasic behaviors:<br>The schema is this:<br><br>class IAuthor(form.Schema):<br>

    """<br>    Profile for Book or DVD authors.<br>    """<br><br>    portrait = namedfile.NamedBlobImage(<br>        title=_(u"Author's Portrait/Photo"),<br>        description=_(u"Portrayal of the Author."),<br>

        required=True,<br>    )<br><br>    form.widget(bio="plone.app.z3cform.wysiwyg.WysiwygFieldWidget")<br>    bio = schema.Text(<br>        title=_(u"Author's Bio"),<br>        description=_(u"The Author's Bio"),<br>

        required=True,<br>    )<br><br>The template is very basic:<br><br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" xml:lang="en"<br>      xmlns:tal="<a href="http://xml.zope.org/namespaces/tal">http://xml.zope.org/namespaces/tal</a>"<br>

      xmlns:metal="<a href="http://xml.zope.org/namespaces/metal">http://xml.zope.org/namespaces/metal</a>"<br>      xmlns:i18n="<a href="http://xml.zope.org/namespaces/i18n">http://xml.zope.org/namespaces/i18n</a>"<br>

      lang="en"<br>      metal:use-macro="context/main_template/macros/master"<br>      i18n:domain="holokinesislibros.contenttypes"><br><body><br><br><br><metal:main fill-slot="content-core"><br>

  <metal:content-core define-macro="content-core"><br><br>        <div class="bio-portrait"<br>             tal:define="portrait nocall:context/portrait"<br>             tal:condition="nocall:portrait"><br>

             <img tal:replace="structure context/@@images/portrait/mini" /><br>        </div><br><br>       <div tal:content="structure context/bio" /><br><br>  </metal:content-core><br>

</metal:main><br><br></body><br></html><br><br>If I add an author with non-ascii chars in the title, the template will throw a traceback:<br><br>2011-07-28 09:34:42 ERROR Zope.SiteErrorLog 1311870882.960.569752426632 <a href="http://localhost:8002/Plone/author-with-accents-aeion/view">http://localhost:8002/Plone/author-with-accents-aeion/view</a><br>

Traceback (innermost last):<br>  Module ZPublisher.Publish, line 126, in publish<br>  Module ZPublisher.mapply, line 77, in mapply<br>  Module ZPublisher.Publish, line 46, in call_object<br>  Module grokcore.view.components, line 100, in __call__<br>

  Module grokcore.view.components, line 104, in _render_template<br>  Module five.grok.components, line 134, in render<br>  Module zope.pagetemplate.pagetemplate, line 113, in pt_render<br>  Module zope.tal.talinterpreter, line 271, in __call__<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 888, in do_useMacro<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>

  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 954, in do_defineSlot<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 858, in do_defineMacro<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 954, in do_defineSlot<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 954, in do_defineSlot<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>

  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 946, in do_defineSlot<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 858, in do_defineMacro<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal<br>

  Module zope.tal.talinterpreter, line 518, in do_optTag<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 852, in do_condition<br>

  Module zope.tal.talinterpreter, line 343, in interpret<br>  Module zope.tal.talinterpreter, line 531, in do_optTag_tal<br>  Module zope.tal.talinterpreter, line 513, in no_tag<br>  Module zope.tal.talinterpreter, line 343, in interpret<br>

  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal<br>  Module Products.PageTemplates.Expressions, line 218, in evaluateStructure<br>  Module zope.tales.tales, line 696, in evaluate<br>   - URL: /home/tzicatl/Aplicaciones/Codigo/pu/holokinesis_libros/src/holokinesislibros.contenttypes/holokinesislibros/contenttypes/templates/<a href="http://author.pt">author.pt</a><br>

   - Line 17, Column 13<br>   - Expression: <PathExpr standard:u'context/@@images/portrait/mini'><br>   - Names:<br>      {'args': (),<br>       'container': <Author at /Plone/author-with-accents-aeion>,<br>

       'context': <Author at /Plone/author-with-accents-aeion>,<br>       'default': <object object at 0xb783b6b0>,<br>       'here': <Author at /Plone/author-with-accents-aeion>,<br>

       'loop': {},<br>       'nothing': None,<br>       'options': {},<br>       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xcb6289c>,<br>       'request': <HTTPRequest, URL=<a href="http://localhost:8002/Plone/author-with-accents-aeion/view">http://localhost:8002/Plone/author-with-accents-aeion/view</a>>,<br>

       'root': <Application at >,<br>       'static': <five.grok.components.ZopeTwoDirectoryResource object at 0xb5309c0c>,<br>       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xd329c8c>,<br>

       'traverse_subpath': [],<br>       'user': <PropertiedUser 'admin'>,<br>       'view': <holokinesislibros.contenttypes.author.View object at 0xb533848c>,<br>       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xb532348c>}<br>

  Module zope.tales.expressions, line 217, in __call__<br>  Module Products.PageTemplates.Expressions, line 147, in _eval<br>  Module zope.tales.expressions, line 124, in _eval<br>  Module Products.PageTemplates.Expressions, line 97, in trustedBoboAwareZopeTraverse<br>

  Module zope.traversing.adapters, line 136, in traversePathElement<br>   - __traceback_info__: (<Products.Five.metaclass.ImageScaling object at 0xb53306cc>, 'portrait')<br>  Module plone.namedfile.scaling, line 126, in traverse<br>

  Module plone.namedfile.scaling, line 68, in tag<br>  Module plone.namedfile.scaling, line 68, in <genexpr><br>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)<br>

<br><br>This is the plone.namedfile.scaling.ImageScale::tag() function:<br><br>    def tag(self, height=_marker, width=_marker, alt=_marker,<br>            css_class=None, title=_marker, **kwargs):<br>        """Create a tag including scale<br>

        """<br>        if height is _marker:<br>            height = getattr(self, 'height', self.data._height)<br>        if width is _marker:<br>            width = getattr(self, 'width', self.data._width)<br>

<br>        if alt is _marker:<br>            alt = self.context.Title()<br>        if title is _marker:<br>            title = self.context.Title()<br><br>        values = [<br>            ('src', self.url),<br>
            ('alt', alt),<br>
            ('title', title),<br>            ('height', height),<br>            ('width', width),<br>            ('class', css_class),<br>            ]<br>        values.extend(kwargs.items())<br>

<br>        parts = ['<img']<br>        parts.extend("%s=%s" % (k, quoteattr(unicode(v))) for k, v in values if v is not None)<br>        parts.append('/>')<br>        <br>        return u' '.join(parts)<br>

<br>It takes the context's title and uses it for the alt and title attributes of the img tag.  Is this a bug in plone.app.scaling or in my code?<br><br clear="all"><br>-- <br><span style="color:rgb(255, 204, 102)">---</span><br>


<span style="color:rgb(204, 153, 51)">Noe Nieto</span><br>
NNieto Consulting Services<br>
M: <a href="mailto:nnieto@noenieto.com" target="_blank">nnieto@noenieto.com</a><br>
W: <a href="http://noenieto.com" target="_blank">http://noenieto.com</a><br>
T:  <a href="https://twitter.com/#%21/tzicatl" target="_blank">@tzicatl</a><br>Li: <a href="http://www.linkedin.com/profile/view?id=84300665" target="_blank">Perfil en LinkedIn</a><br><br>