summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Fretin <vincent.fretin@gmail.com>2013-05-13 07:21:59 (GMT)
committerVincent Fretin <vincent.fretin@gmail.com>2013-05-13 07:21:59 (GMT)
commitc629eb2ed74f51626daedd3998e271ee748a9c69 (patch)
treeff9aa4a4b390ecdb08264c7c3606fc6547282c5f
parentf0c80475163a971d7e4c3036c7eb18f34ea9bfd9 (diff)
parent5a766ca70aa9ac0a46d605a4918b5a6558c92591 (diff)
downloadcollective.contact.widget-c629eb2ed74f51626daedd3998e271ee748a9c69.zip
collective.contact.widget-c629eb2ed74f51626daedd3998e271ee748a9c69.tar.gz
collective.contact.widget-c629eb2ed74f51626daedd3998e271ee748a9c69.tar.bz2
Merge branch 'master' of git://repos.entrouvert.org/collective.contact.widget
-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'