With the attached patch, it is now possible to display <optgroup> HTML tags with SelectWidget. The widget accepts a long_label_generator attribute/argument that can be used to generate a "label" attribute on the <option> tags for very old browsers that do not support the <optgroup> tag.
A few notes:
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.
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.
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.
Thx for your contribution !
Can you add documentation and tests directly to deform and deformdemo codebases, please ?
Allow SelectWidget to produce <optgroup> HTML tags.
Add views and tests for the new optgroup feature in deform (see Pylon…
I have rebased my branch (it was old and was lagging behind master). It contains tests and documentation for "deform". As for "deformdemo", I have created another pull request (Pylons/deformdemo#10) that contains views and tests.