include object type, remove newlines, in related docs

This commit is contained in:
Frédéric Péters 2012-05-02 14:18:50 +02:00
parent be8351129d
commit b46f68575a
1 changed files with 8 additions and 3 deletions

View File

@ -341,9 +341,14 @@ class RelatedDocObjPathSource(ObjPathSource):
value = brain._unrestrictedGetObject()
else:
value = brain.getPath()[len(self.portal_path):]
return SimpleTerm(value, token=brain.getPath(), title=u'%s [%s]' % (
unicode(brain.Title, 'utf-8'),
brain.getObject().Type()))
if type(brain.Title) is unicode:
title = brain.Title
else:
title = unicode(brain.Title, 'utf-8')
return SimpleTerm(value, token=brain.getPath(), title=u'%s [%s]' % (
title.replace('\n', ' - ').replace('\r', ''),
brain.Type))
class RelatedDocObjPathSourceBinder(ObjPathSourceBinder):
path_source = RelatedDocObjPathSource