From 40e05c00f46cf008dede19e4afede1b093dc0d45 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 17 Sep 2006 11:51:28 +0000 Subject: [PATCH] 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 --- README.txt | 2 +- resource.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 46fe4c7..a5e35f8 100755 --- a/README.txt +++ b/README.txt @@ -318,7 +318,7 @@ Index attributes adapter >>> from loops.resource import IndexAttributes >>> idx = IndexAttributes(doc1) >>> idx.text() - '' + u'' >>> idx.title() u'doc1 Zope Info' diff --git a/resource.py b/resource.py index b251565..38373db 100644 --- a/resource.py +++ b/resource.py @@ -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