Python / Pylons… Setting the CSS Class on a webhelpers.html.tags Select List

Real quick one, once again just for my future searching concerns, just wanted to point out how to set the css class on a select list when using the helper. Won’t get into how I hate html helper classes, but in this case it’s for something so simple AND it makes it easier to hook into a precreated list. Anyways, it’s me being lazy and breaking my rules.

With that being said, took me a bit to find out how to set the css class on the created select list:

    ${'selectGender', '', h.lookups.list(h.lookups.GENDER_LOOKUP), 'selectGender', class_='input' ) }

Its that “class_=” part. Really simple once you see it, but annoying if you don’t know it.

Just a quick break down on what the select method takes in:, selected option, list, id, extra stuff)