CustomWidgetFactory passes wrong arguments to a MultiCheckBoxWidget

Bug #98294 reported by Joachim Werner
2
Affects Status Importance Assigned to Milestone
Zope 3
Fix Released
Critical
Unassigned

Bug Description

I want to use a MultiCheckBoxWidget as a custom widget for a field that is a List with value_type Choice.

In Zope 3.1 this only worked if I subclassed my own widget and made sure that the vocabulary from the value_type was passed.

In Zope 3.2 this should be fixed, but it doesn't work as expected. The widget gets the value_type instead of the value_type's vocabulary passed.

See the following lines in zope/app/form/__init__.py (lines 107ff):

    def __call__(self, context, request):

        # Sequence widget factory
        if ICollection.providedBy(context):
            args = (context, context.value_type, request) + self.args

        # Vocabulary widget factory
        elif IChoice.providedBy(context):
            args = (context, context.vocabulary, request) + self.args

Replacing line 111

            args = (context, context.value_type, request) + self.args

by

            args = (context, context.value_type.vocabulary, request) + self.args

fixes my problem. I don't know if this causes new problems somewhere else.

Revision history for this message
Stephan Richter (srichter) wrote :

Changes: submitter email, importance (medium => critical), new comment

I think this has been addressed.

Revision history for this message
Christian Theune (ctheune) wrote :

I checked the tests for this. Currently (3.3 branch) context.value_type.vocabulary does not exist. So maybe this was adressed in a different way than proposed in this issue.

Bavarian: can you check whether it is still broken in 3.3 or the trunk?

Revision history for this message
Jim Fulton (jim-zope) wrote :

Status: Pending => Resolved

We'll assume this is fixed. It can be reopened if someone finds out differently.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.