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:
helmutm 2006-09-17 11:51:28 +00:00
parent ab707787fb
commit 40e05c00f4
2 changed files with 4 additions and 2 deletions

View file

@ -318,7 +318,7 @@ Index attributes adapter
>>> from loops.resource import IndexAttributes
>>> idx = IndexAttributes(doc1)
>>> idx.text()
''
u''
>>> idx.title()
u'doc1 Zope Info'

View file

@ -237,8 +237,10 @@ class IndexAttributes(object):
def text(self):
context = self.context
if not context.contentType.startswith('text'):
return ''
return u''
data = context.data
if type(data) != unicode:
data = data.decode('UTF-8')
# TODO: transform to plain text
#return ' '.join((zapi.getName(context), context.title, data)).strip()
return data