[Plone-IT] portlet tal

Yuri yurj a alfa.it
Mar 23 Lug 2013 07:14:07 UTC


Il 22/07/2013 16:13, Fabrizio Rota ha scritto:
> Può essere collegato?
> https://dev.plone.org/ticket/13631

Non credo.

hai provato a mettere decode al posto di encode in quello che avevo 
scritto sotto?

>
>
> Il giorno 22 luglio 2013 13:41, Fabrizio Rota <fabrizio.rota a gmail.com 
> <mailto:fabrizio.rota a gmail.com>> ha scritto:
>
>     Nulla, non funge lo stesso:
>
>     Tipo di eccezione
>         UnicodeDecodeError
>     Valore eccezione
>         'ascii' codec can't decode byte 0xc3 in position 85: ordinal
>         not in range(128)
>
>     La cosa assurda è che il "libro della settimana" visto come news
>     funziona perfettamente: è mostrarlo nel portlet che dà questo
>     problema. Boh!
>
>
>     Grazie dell'attenzione!
>
>
>
>
>     Il giorno 22 luglio 2013 08:49, Yuri <yurj a alfa.it
>     <mailto:yurj a alfa.it>> ha scritto:
>
>         Il 19/07/2013 14:09, Fabrizio Rota ha scritto:
>
>             Uso un portlet "tal" per mostrare il "libro della
>             settimana" che gli utenti caricano compilando un form
>             ploneformgen.
>
>             Il libro della settimana viene mappato verso una
>             normalissima news.
>
>             Se il titolo contiene accentate, il portlet dà errore
>             unidecoderror.
>
>             il codice del portlet tal è questo:
>
>
>
>             <metal:block define-macro="portlet">
>             <div id="portlet_libri"
>             tal:define="presults
>             python:context.portal_catalog(portal_type='News Item',
>             path='/www.isisromero.gov.it/news/libri
>             <http://www.isisromero.gov.it/news/libri>
>             <http://www.isisromero.gov.it/news/libri>',
>             sort_on='effective', sort_order='reverse')"
>
>             tal:condition="presults">
>
>
>             <tal:block define="pobj python:presults[0].getObject()">
>
>
>             <h2> Libro della settimana</h2>
>             <h3 tal:content=pobj/Title>IL TITOLO DEL LIBRO </h3>
>
>
>         a parte il fatto che puoi evitare di fare il getObject:
>
>         <h3 tal:content="python:presults[0].Title" />
>
>         se hai problemi per le accentate fai così:
>
>         tal:content="python:pobj.Title().encode('utf-8')" (o decode,
>         uno dei due funziona :-D)
>
>         Comunque è strano perché dovresti sempre ottenere la stringa
>         giusta senza encoding, quindi probabilmente il problema sta
>         nello script che crea l'oggetto (cioè quello che passi a
>         setTitle, prova a fare delle prove lì con decode/encode). Puoi
>         anche verificare come il catalogo ha indicizzato quel titolo,
>         andando in portal_catalog.
>
>
>
>             .........
>
>             Il sito del portlet è www.isisromero.gov.it
>             <http://www.isisromero.gov.it> <http://www.isisromero.gov.it>
>
>
>             Come posso far digerire le accenteate al portlet? Il
>             "libro della settimana" come oggetto news viene creato
>             regolarmente, il problema è la visualizzazione tramite
>             portlet!
>
>             -- 
>             Fabrizio
>             --------------------
>             Non inviato da IPhone
>
>             "Life is what happens to you while you're busy making
>             other plans" - J. Lennon
>
>             “If you think education is expensive, try ignorance” - D. Bok
>
>             Life is like a game of cards. The hand you are dealt is
>             determinism; the way you play it is free will - Jawaharlal
>             Nehru
>
>
>             _______________________________________________
>             Plone-IT mailing list
>             Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>             https://lists.plone.org/mailman/listinfo/plone-plone-it
>             http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html
>
>
>         _______________________________________________
>         Plone-IT mailing list
>         Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>         https://lists.plone.org/mailman/listinfo/plone-plone-it
>         http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html
>
>
>
>
>     -- 
>     Fabrizio
>     --------------------
>     Non inviato da IPhone
>
>     "Life is what happens to you while you're busy making other plans"
>     - J. Lennon
>
>     “If you think education is expensive, try ignorance” - D. Bok
>
>     Life is like a game of cards. The hand you are dealt is
>     determinism; the way you play it is free will - Jawaharlal Nehru
>
>
>
>
> -- 
> Fabrizio
> --------------------
> Non inviato da IPhone
>
> "Life is what happens to you while you're busy making other plans" - 
> J. Lennon
>
> “If you think education is expensive, try ignorance” - D. Bok
>
> Life is like a game of cards. The hand you are dealt is determinism; 
> the way you play it is free will - Jawaharlal Nehru
>
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-plone-it
> http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html



Maggiori informazioni sulla lista Plone-IT