Viewlet managers for CSS and JavaScript should be ordered

Bug #745513 reported by Douglas Cerna
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
New
Low
Unassigned

Bug Description

There's no way to control the order in which file resources are included.

Regular viewlet managers use this method for sorting viewlets:

-------------------- %< --------------------

    def sort(self, viewlets):
        """Sort the viewlets.

        ``viewlets`` is a list of tuples of the form (name, viewlet).
        """
        # By default, use the standard Python way of doing sorting.
        return sorted(viewlets, lambda x, y: cmp(x[1], y[1]))

-------------------- %< --------------------

which I understand compares the viewlet objects. And as far as I can tell, viewlet objects have no explicit comparison magic methods, right?

Changed in schooltool:
importance: Undecided → Low
Revision history for this message
Justas Sadzevičius (justas.sadzevicius) wrote :

Right. You could probably hack something with overriding __cmp__, but don't forget to keep (a > b) == (b < a).

So yes, we do need decent sort control.

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.