Problems with ObjPathSourceBinder in a RelationList field Definition

66 views
Skip to first unread message

philippe gross

unread,
Feb 22, 2010, 8:10:03 AM2/22/10
to Dexterity development
Hi

i have a ReleationList field definition like this:

relatedDossier = RelationList(
title=_(u'label_related_dossier', default=u'Related Dossier'),
default=[],
value_type=RelationChoice(title=u"Related",

source=ObjPathSourceBinder({'portal_type':'dummy.businesscasedossier'})),
required=False,
)

Actually that works fine, but i have the problem that when i set the
portal_type like above ('portal_type':'dummy.businesscasedossier'),
the content treewidget show only the actual branch and not the whole
site. When i set none parameters like
(source=ObjPathSourceBinder()), ) the whole site becomes display.

What i have to do that all branches would display, but only the
dummy.businesscasedossier?


Thanks
Phippu

Martin Aspeli

unread,
Feb 22, 2010, 8:13:14 AM2/22/10
to dexterity-...@googlegroups.com
Hi,

> source=ObjPathSourceBinder({'portal_type':'dummy.businesscasedossier'})),

This is wrong. If you look at the ObjPathSourceBinder constructor, it
looks like this:

def __init__(self, navigation_tree_query=None, **kw):
self.selectable_filter = CustomFilter(**kw)
self.navigation_tree_query = navigation_tree_query

The idea is that you pass a dict as a positional argument (what you've
done) to control what is shown in the tree, and use keyword arguments
to specify the actual filter for the selectable value. So I think what
you want is:

ObjPathSourceBinder(portal_type=dummy.businesscasedossier')

You can use the optional positional argument if you also want to prune
some parts of the tree, e.g. to only show published folders or
whatever.

Martin

philippe gross

unread,
Feb 22, 2010, 8:29:36 AM2/22/10
to Dexterity development
Hi

Yes, so it works fine.

Thanks
Phippu

Reply all
Reply to author
Forward
0 new messages