[Zope3-dev] widgets for sources not yet complete?

Sam Stainsby sam at stainsby.id.au
Wed Apr 19 18:27:08 EDT 2006


This is in part reposted from gmane.comp.web.zope.zope3.users as I didn't
get a response there.

I have recently tried to switch from using vocabularies  to sources.
Sources seem to make a lot more sense, but I'm having trouble getting the
widgets I want.

I'll simplify my scenario here from what I posted before. Hopefully this
is simpler (and I also have corrected a typo):

class IUnitsSingleSelector(Interface):
    units = Choice(
        title=u'Allowed Units',
        source=u'SA UnitsContainer Contents Source', required=False,
    )

class IUnitsMultiSelector(Interface):
    unitSets = List(
        title=u'Allowed Units',
        value_type=Choice(
            source=u'SA UnitsContainer Contents Source', required=False,
        ),
    )
class IInventory1(IContainer, IUnitsSingleSelector):
    """An inventory of items."""
    contains('.IItem', '.IUnitsContainer')

class IInventory2(IContainer, IUnitsMultiSelector):
    """An inventory of items."""
    contains('.IItem', '.IUnitsContainer')

In the IInventory2 case, I was expecting to get a nice in-out
ordered list widget like I did back when I was using vocabularies (an
OrderedMultiSelectWidget I'm guessing from the Zope  3 code). Instead I
got an error about not finding an adapters supporting ISourceQueriables.
When I made my source provide ISourceQueriablessupport, I
eliminated the error, but instead just got a blank label with the 'Allowed
Units' title.

>From looking the Zope 3 code, I suspect that the full set of widgets is
not yet available for sources. Or have I got that wrong? I see there are
some simpler widgets there that build the widgets used by vocabularies.
I'm happy to try my hand at adding to that set of widget if nobody else is
doing it. Maybe this is being done a different way for sources?



More information about the Zope3-dev mailing list