diff --git a/themis/fields/__init__.py b/themis/fields/__init__.py index 623160e..219b2dd 100644 --- a/themis/fields/__init__.py +++ b/themis/fields/__init__.py @@ -36,8 +36,8 @@ from themis.fields.interfaces import IDocHistoLine, IDocHistoLines from themis.fields.vocabs import SubjectsSource from themis.fields.vocabs import LegislativeSessionsSource +from themis.fields.vocabs import RelatedDocObjPathSourceBinder -from plone.formwidget.contenttree import ObjPathSourceBinder from z3c.relationfield.schema import Relation, RelationList @@ -349,14 +349,14 @@ class RelatedDoc(Relation): def __init__(self, **kw): super(RelatedDoc, self).__init__(**kw) - self.vocabulary = ObjPathSourceBinder() + self.vocabulary = RelatedDocObjPathSourceBinder() source = property(lambda self: self.vocabulary) def bind(self, object): """See zope.schema._bootstrapinterfaces.IField.""" clone = super(RelatedDoc, self).bind(object) - clone.vocabulary = self.vocabulary(object) + clone.vocabulary = RelatedDocObjPathSourceBinder()(object) return clone diff --git a/themis/fields/vocabs.py b/themis/fields/vocabs.py index 91e3a18..1cff646 100644 --- a/themis/fields/vocabs.py +++ b/themis/fields/vocabs.py @@ -13,6 +13,7 @@ from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from Products.CMFCore.utils import getToolByName from plone.registry.interfaces import IRegistry +from plone.formwidget.contenttree import ObjPathSourceBinder try: from tabellio.config.interfaces import ITabellioSettings @@ -266,3 +267,8 @@ class LegislativeSessionsSource(object): # Legislative sessions def __iter__(self): # hack to let schema editor handle the field yield u'DO NOT TOUCH' + +class RelatedDocObjPathSourceBinder(ObjPathSourceBinder): + def __iter__(self): + # hack to let schema editor handle the field + yield u'DO NOT TOUCH'