indexing fix: ensure that index strings are always unicode
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1348 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
ab707787fb
commit
40e05c00f4
2 changed files with 4 additions and 2 deletions
|
@ -318,7 +318,7 @@ Index attributes adapter
|
||||||
>>> from loops.resource import IndexAttributes
|
>>> from loops.resource import IndexAttributes
|
||||||
>>> idx = IndexAttributes(doc1)
|
>>> idx = IndexAttributes(doc1)
|
||||||
>>> idx.text()
|
>>> idx.text()
|
||||||
''
|
u''
|
||||||
|
|
||||||
>>> idx.title()
|
>>> idx.title()
|
||||||
u'doc1 Zope Info'
|
u'doc1 Zope Info'
|
||||||
|
|
|
@ -237,8 +237,10 @@ class IndexAttributes(object):
|
||||||
def text(self):
|
def text(self):
|
||||||
context = self.context
|
context = self.context
|
||||||
if not context.contentType.startswith('text'):
|
if not context.contentType.startswith('text'):
|
||||||
return ''
|
return u''
|
||||||
data = context.data
|
data = context.data
|
||||||
|
if type(data) != unicode:
|
||||||
|
data = data.decode('UTF-8')
|
||||||
# TODO: transform to plain text
|
# TODO: transform to plain text
|
||||||
#return ' '.join((zapi.getName(context), context.title, data)).strip()
|
#return ' '.join((zapi.getName(context), context.title, data)).strip()
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Add table
Reference in a new issue