simplify code, use safe_unicode

This commit is contained in:
Vincent Fretin 2013-08-23 11:28:42 +02:00
parent 9fb5c01ee5
commit 5b335bcb6a
1 changed files with 2 additions and 9 deletions

View File

@ -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()
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')
full_title = unicode(
full_title = safe_unicode(brain.get_full_title or brain.Title or
return Term(value, token=brain.getPath(), title=full_title, brain=brain)
def tokenToPath(self, token):