Pylons/deform — pull request #87 by dbaty (2012-04-10 08:31:57+00:00)
Title: Allow SelectWidget to produce <optgroup> HTML tags.

With the attached patch, it is now possible to display `` HTML tags with `SelectWidget`. The widget accepts a `long_label_generator` attribute/argument that can be used to generate a "label" attribute on the `
` tags for very old browsers that do not support the `` tag.

A few notes:

1. There is probably no use-case where one would want to customize the `optgroup_class` attribute/argument. It is there only to make the `OptGroup` class available in the template.

2. With the `:members:` option of the `autoclass` directive, Sphinx automatically generates a line of documentation for `optgroup_class`: "Alias of OptGroup". Because this is rather useless and we already document it ourselves, I removed the `:members:` option. I did not notice any side-effect.

3. I took the liberty of changing the example for the two-tuples in `values`. I find the new example slightly clearer than the previous one (`('true', 'True')`).

Thanks to Jeff Dairiki who provided feedback on my previous attempt and suggested the `OptGroup` class and the `long_label_generator` option.