From b46f68575a1a1b5a1de423bb255821269f4dfb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 2 May 2012 14:18:50 +0200 Subject: [PATCH] include object type, remove newlines, in related docs --- themis/fields/vocabs.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/themis/fields/vocabs.py b/themis/fields/vocabs.py index fd8037b..d1cdeec 100644 --- a/themis/fields/vocabs.py +++ b/themis/fields/vocabs.py @@ -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