[Twisted-web] Sorting an option list

Ed Lea ed at orangebits.cx
Fri Jul 9 05:14:00 MDT 2004


This may not be solvable with nevow/stan but I'm hoping it may be...

I'm doing

return t.select(name="establishment")[
        [
            t.option(value=e['_oid'])[e['establishment_desc']]
            for e in data
        ]
    ]

to create a select list from data, where data is in the form

[{'_oid': '1', 'establishment_desc': 'foo'},
 {'_oid': '2', 'establishment_desc': 'bar'},
 ... ]

The drop down that is created really needs to be sorted alphabetically
by the establishment_desc.

I realise I can probably write a function to sort the data myself and
pass it to data.sort(), but I was wondering if there was a way to do it
with stan or nevow after the DOM has been created.

-- 
Ed.

Fertility is hereditary.  If your parents didn't have any children,
neither will you.



More information about the Twisted-web mailing list