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

JoseLuis de la Rosa Triviño joseluis.rosa at iavantefundacion.com
Wed May 31 19:37:05 CEST 2006


Hello everybody,

 

I'm creating documents programatically with this snippet:

 

{{{

folderProxy = context

title = context.Localizer.default.gettext('title_' + btool.ptool.CONTENTS_ID , language)

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:

 

{{{

File "/opt/zope2.9/lib/python/ZPublisher/Publish.py", line 120, in publish

    transactions_manager.commit()

  File "/opt/zope2.9/lib/python/Zope2/App/startup.py", line 240, in commit

    transaction.commit()

  File "/opt/zope2.9/lib/python/transaction/_manager.py", line 96, in commit

    return self.get().commit(sub, deprecation_wng=False)

  File "/root/instances/saludinnova2/Products/CPSCompat/PatchZODBTransaction.py", line 169, in commit

    self._callBeforeCommitHooks()

  File "/opt/zope2.9/lib/python/transaction/_transaction.py", line 421, in _callBeforeCommitHooks

    hook(*args, **kws)

  File "/root/instances/saludinnova2/Products/CPSCore/commithooks.py", line 229, in __call__

    subscriber(*args, **kws)

  File "/root/instances/saludinnova2/Products/CPSCore/IndexationManager.py", line 132, in __call__

    self.process(info['object'], info['idxs'], info['secu'])

  File "/root/instances/saludinnova2/Products/CPSCore/IndexationManager.py", line 151, in process

    ob._reindexObject(idxs=idxs)

  File "/root/instances/saludinnova2/Products/CPSCore/ProxyBase.py", line 402, in _reindexObject

    return CMFCatalogAware.reindexObject(self, idxs=idxs)

  File "/root/instances/saludinnova2/Products/CMFCore/CMFCatalogAware.py", line 87, in reindexObject

    catalog.reindexObject(self, idxs=idxs)

  File "/root/instances/saludinnova2/Products/CMFCore/CatalogTool.py", line 353, in reindexObject

    self.catalog_object(object, uid, idxs, update_metadata)

  File "/root/instances/saludinnova2/Products/CPSCore/PatchCMFCoreCatalogTool.py", line 242, in cat_catalog_object

    ZCatalog.catalog_object(self, w, uid, idxs, update_metadata, *pgharg)

  File "/opt/zope2.9/lib/python/Products/ZCatalog/ZCatalog.py", line 566, in catalog_object

    update_metadata=update_metadata)

  File "/opt/zope2.9/lib/python/Products/ZCatalog/Catalog.py", line 360, in catalogObject

    blah = x.index_object(index, object, threshold)

  File "/opt/zope2.9/lib/python/Products/PluginIndexes/common/UnIndex.py", line 235, in index_object

    res += self._index_object(documentId, obj, threshold, attr)

  File "/opt/zope2.9/lib/python/Products/PluginIndexes/common/UnIndex.py", line 262, in _index_object

    self.insertForwardIndexEntry(datum, documentId)

  File "/opt/zope2.9/lib/python/Products/PluginIndexes/common/UnIndex.py", line 207, in insertForwardIndexEntry

    indexRow = self._index.get(entry, _marker)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf3 in position 11: ordinal not in range(128)

}}}

 

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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nuxeo.com/pipermail/cps-devel/attachments/20060531/5623bf08/attachment.html


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.