[CPS-devel] UnicodeDecodeError indexing translated title of document.

JoseLuis de la Rosa Triviño joseluis.rosa at iavantefundacion.com
Fri Jun 2 12:54:03 CEST 2006


Hi, 

I go on having this problem, even translating with mcat. The strings that cause UnicodeDecodeError when they are indexed are titles of documents that I create programatically using some translations from translation_service, as you saw in the code.

It's very funny that the error happends with some users (the name of the user is included in the title).
Definitely, I can't assure what the cause of the error is. I tried to translate messages from ZMI (to avoid possible Eric IDE problems) and the error remains. 
I get these bug scenes:

1.- When the whole title is gotten from translation_service.
2.- When the title is assembled with member.getProperty('fullname') and with translated sentences.

However, I got the same scenes with success in the creation of the document, so it's seems like a heisenbug now.

I'm seriously in trouble with this as my portal should go to production next week.

Do you have any other idea of how could I mend this?

This is another traceback of the exception:
{{{
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 10: ordinal not in range(128)
> /opt/zope2.9/lib/python/Products/PluginIndexes/common/UnIndex.py(207)insertForwardIndexEntry()
-> indexRow = self._index.get(entry, _marker)
(Pdb) entry
u'Carlos Gonzalez created aaaaaaaaaaaaaa'
(Pdb) list
202             """Take the entry provided and put it in the correct place
203             in the forward index.
204
205             This will also deal with creating the entire row if necessary.
206             """
207  ->         indexRow = self._index.get(entry, _marker)
208
209             # Make sure there's actually a row there already.  If not, create
210             # an IntSet and stuff it in first.
211             if indexRow is _marker:
212                 self._index[entry] = documentId
(Pdb)
}}}

Thank you very much.

JoseLuis de la Rosa Triviño 
Becario Área de Sistemas de Información 
FUNDACIÓN IAVANTE 
joseluis.rosa at iavantefundacion.com 
Tel. 951 015 300 


Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda copia o divulgación deberá ser autorizada por IAVANTE.

This e-mail and any attachments are confidential and exclusively directed to its adressee(s). Any copy or distribution will have to be authorized by IAVANTE.



-----Mensaje original-----
De: Julien Anguenot [mailto:ja at nuxeo.com] 
Enviado el: jueves, 01 de junio de 2006 13:00
Para: JoseLuis de la Rosa Triviño
CC: cps-devel at lists.nuxeo.com
Asunto: Re: [CPS-devel] UnicodeDecodeError indexing translated title of document.

Hi,

JoseLuis de la Rosa Triviño wrote:
> The problem was the charset "Eric IDE" used to save the .po file. I copied and pasted the translations from another application and it seems that eric doesn't manage charset well when this is done.
> I removed the translations messages from .po file, write them again by hand and everything works fine now.

oh ok.

> However, thanks for your suggestion cause I'll try it if I have the problem again.

This way is the current CPS way to do it.

> Only one thing else, what IDE do you recommend me to use for python that allows to work with svn repository? Or which is the one that you use in Nuxeo?

I'm using emacs myself  but you should consider Eclipse + pydev +
subclipse as an IDE I guess.

> Thank you very much.

you're welcome :)

	J.

> Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda copia o divulgación deberá ser autorizada por IAVANTE.
> 
> This e-mail and any attachments are confidential and exclusively directed to its adressee(s). Any copy or distribution will have to be authorized by IAVANTE.
> 
> 
> 
> -----Mensaje original-----
> De: Julien Anguenot [mailto:ja at nuxeo.com] 
> Enviado el: jueves, 01 de junio de 2006 0:14
> Para: JoseLuis de la Rosa Triviño
> CC: cps-devel at lists.nuxeo.com
> Asunto: Re: [CPS-devel] UnicodeDecodeError indexing translated title of document.
> 
> JoseLuis de la Rosa Triviño wrote:
>> I'm creating documents programatically with this snippet:
>> {{{
>>
>> folderProxy = context
>>
>> title = context.Localizer.default.gettext('title_' +
>> btool.ptool.CONTENTS_ID , language)
>>
> 
> Can you try out this ?
> 
> mcat = context.translation_service
> mcat.changeLanguage(lang=language)
> title = mcat('title_' + btool.ptool.CONTENTS_ID)
> 
> 	J.
> 
>> docDef = {TITLE:title, DESCRIPT:'', HIDDE:0}
>>
>>  
>>
>> idFolder = btool.ptool.CONTENTS_ID
>>
>> docDef['id'] = idFolder
>>
>> folderProxy.invokeFactory(btool.util.WORKSPACE_PCONTENT_TYPE, idFolder)
>>
>> docProxy = getattr(folderProxy, idFolder)
>>
>> doc = docProxy.getEditableContent()
>>
>> doc.edit(docDef, docProxy)
>>
>> }}}
>>
>>  
>>
>> As you saw the title of the document is translated before edition. My
>> problem is that I get an UnicodeDecodeError when that title is indexed.
>> Can anyone help me? What should I do to mend this kind of errors?
>>
>>  
>>
>> The traceback of the error is:
> 
> [...]
> 
> 


-- 
Julien Anguenot | Nuxeo R&D (Paris, France)
Open Source ECM - www.nuxeo.com
CPS Platform - http://www.cps-project.org
Mobile: +33 (0) 6 72 57 57 66



More information about the cps-devel mailing list

This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.