SourceTerms ignores ordering from the ITerms vocabulary

Bug #627475 reported by Brian Sutherland on 2010-08-31
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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.

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  Edit
Everyone can see this information.

Other bug subscribers