SourceTerms ignores ordering from the ITerms vocabulary

Bug #627475 reported by Brian Sutherland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
z3c.form
Confirmed
Undecided
Unassigned

Bug Description

in z3c.form.term, this code:

class SourceTerms(Terms):
    """Base implementation for ITerms using a source instead of a vocabulary."""
...
    def __iter__(self):
        for value in self.source:
            yield self.terms.getTerm(value)

Uses the ordering from the source rather than the ITerms adapter. Since the source has no access to the request, the terms cannot be sorted in a request-sensitive way. i.e. you cannot take into account translations when sorting.

I believe that the __iter__ method of SourceTerms should just be removed allowing the ITerms adapter to do the sorting. The ITerms interface does require an __iter__ method.

I'll commit on a patch+tests for this if I get a +1 or no-one objects for a while.

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

Sounds good. Feel free to commit the patch.

Changed in z3c.form:
status: New → Confirmed
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.