summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Fretin <vincent.fretin@gmail.com>2013-08-23 09:28:42 (GMT)
committerVincent Fretin <vincent.fretin@gmail.com>2013-08-23 09:28:42 (GMT)
commit5b335bcb6a4aa3d27baefeb7ada1dbd2283953e7 (patch)
treef51858c0a89c79b5c6fa12b0e823206b1be553fd
parent9fb5c01ee5d4b82c8455e6f69fff59bbfca546e2 (diff)
downloadcollective.contact.widget-5b335bcb6a4aa3d27baefeb7ada1dbd2283953e7.zip
collective.contact.widget-5b335bcb6a4aa3d27baefeb7ada1dbd2283953e7.tar.gz
collective.contact.widget-5b335bcb6a4aa3d27baefeb7ada1dbd2283953e7.tar.bz2
simplify code, use safe_unicode
-rw-r--r--src/collective/contact/widget/source.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/collective/contact/widget/source.py b/src/collective/contact/widget/source.py
index d5a0991..576b6dd 100644
--- a/src/collective/contact/widget/source.py
+++ b/src/collective/contact/widget/source.py
@@ -4,7 +4,7 @@ from zope.schema.vocabulary import SimpleTerm
from Products.ZCTextIndex.ParseTree import ParseError
from plone.formwidget.contenttree.source import PathSourceBinder, ObjPathSource
-from Products.CMFPlone.utils import getToolByName
+from Products.CMFPlone.utils import getToolByName, safe_unicode
class Term(SimpleTerm):
@@ -62,14 +62,7 @@ class ContactSource(ObjPathSource):
value = brain._unrestrictedGetObject()
else:
value = brain.getPath()[len(self.portal_path):]
- 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)
+ full_title = safe_unicode(brain.get_full_title or brain.Title or brain.id)
return Term(value, token=brain.getPath(), title=full_title, brain=brain)
def tokenToPath(self, token):