From 5a766ca70aa9ac0a46d605a4918b5a6558c92591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 2 May 2013 13:28:30 +0200 Subject: [PATCH] adapt to get_full_title() returning unicode objects --- src/collective/contact/widget/source.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/collective/contact/widget/source.py b/src/collective/contact/widget/source.py index dc7d58e..dc6dc6f 100644 --- a/src/collective/contact/widget/source.py +++ b/src/collective/contact/widget/source.py @@ -62,8 +62,15 @@ class ContactSource(ObjPathSource): value = brain._unrestrictedGetObject() else: value = brain.getPath()[len(self.portal_path):] - full_title = brain.get_full_title or brain.Title or brain.id - return Term(value, token=brain.getPath(), title=full_title.decode('utf8'), brain=brain) + if brain.get_full_title: + full_title = brain.get_full_title + elif type(brain.Title) is unicode: + full_title = brain.Title + elif brain.Title: + full_title = unicode(brain.Title, 'utf-8') + else: + full_title = unicode(brain.id) + return Term(value, token=brain.getPath(), title=full_title, brain=brain) def tokenToPath(self, token): """For token='/Plone/a/b', return '/a/b'