Hack around ObjPathSourceBinder to get the related docs type editable
This commit is contained in:
parent
968593bee8
commit
f8afbe179e
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Reference in New Issue