summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2013-05-02 11:28:30 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2013-05-02 11:28:30 (GMT)
commit5a766ca70aa9ac0a46d605a4918b5a6558c92591 (patch)
tree32bae7de3ab8af995be812f97d95c34101cb0f51
parent090c94e9cd355dad39e8ad8f3e96ad8aeab995ea (diff)
downloadcollective.contact.widget-5a766ca70aa9ac0a46d605a4918b5a6558c92591.zip
collective.contact.widget-5a766ca70aa9ac0a46d605a4918b5a6558c92591.tar.gz
collective.contact.widget-5a766ca70aa9ac0a46d605a4918b5a6558c92591.tar.bz2
adapt to get_full_title() returning unicode objects
-rw-r--r--src/collective/contact/widget/source.py11
1 files 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'