[Zope3-Users] Registering adapter for ListSequence widget in tests

Darryl Cousins darryl at darrylcousins.net.nz
Wed Sep 6 00:55:16 EDT 2006


I am having problems registering ListSequence widget, the following from my doctest:

Although most widget adapters are registered in tfws.form.browser testing I had
a lot of trouble with ListSequenceWidget - here I keep trying until I get it.

This is the error raised when running the test::

    ComponentLookupError: ((<zope.schema._field.List object at 0xb704532c>,
    <zope.publisher.browser.TestRequest instance URL=>),
    <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')

If I can't get the widget registered for the test then I shall just have to give
up on the test.

All this is to try to register an adpater to IInputWidget for the schema::

    addlanguage = List(
        title = _("Language"),
        description = _("Add language to content"),
        required = False,
        default = [],
        value_type = TextLine(
            title = _("Langauge")))

It **does** work in the browser.


    >>> from zope.component import provideAdapter
    >>> from zope.app.form.browser import ListSequenceWidget
    >>> from zope.schema.interfaces import IList, IField
    >>> from zope.app.form.interfaces import IInputWidget
    >>> from zope.publisher.interfaces.browser import IBrowserRequest

The zcml configure for same looks like this in zope.app.form.browser.configure::


Following test setup formula in zope.app.form.browser I get this:

    >>> provideAdapter(ListSequenceWidget,[IList,IField,IBrowserRequest], \
    ...                        IInputWidget,)

But no go. See error above.

Best regards,

More information about the Zope3-users mailing list