append object type next to object title in related docs

This commit is contained in:
Frédéric Péters 2012-01-20 10:55:26 +01:00
parent 424b6d3004
commit 46a4ede740
1 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,7 @@ from Products.CMFCore.utils import getToolByName
from plone.registry.interfaces import IRegistry
from plone.formwidget.contenttree import ObjPathSourceBinder
from plone.formwidget.contenttree.source import ObjPathSource
try:
from tabellio.config.interfaces import ITabellioSettings
@ -334,7 +335,19 @@ class LegislativeSessionsSource(object): # Legislative sessions
# hack to let schema editor handle the field
yield u'DO NOT TOUCH'
class RelatedDocObjPathSource(ObjPathSource):
def getTermByBrain(self, brain, real_value=True):
if real_value:
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()))
class RelatedDocObjPathSourceBinder(ObjPathSourceBinder):
path_source = RelatedDocObjPathSource
def __iter__(self):
# hack to let schema editor handle the field
yield u'DO NOT TOUCH'