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

Julien Anguenot ja at nuxeo.com
Thu Jun 1 00:13:44 CEST 2006


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.nuxeo.com/pipermail/cps-devel/attachments/20060601/f6286b32/signature.pgp


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.