Skip to content

Allow SelectWidget to produce <optgroup> HTML tags. #87

merged 1 commit into from Aug 23, 2012

3 participants

dbaty commented Apr 10, 2012

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:

  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.

Pylons Project member
kiorky commented Jul 27, 2012

Thx for your contribution !
Can you add documentation and tests directly to deform and deformdemo codebases, please ?

@dbaty dbaty added a commit to dbaty/deformdemo that referenced this pull request Aug 23, 2012
@dbaty dbaty Add views and tests for the new optgroup feature in deform (see Pylon… 2835b13
@dbaty dbaty referenced this pull request in Pylons/deformdemo Aug 23, 2012

Add views and tests for the new optgroup feature in deform #10

dbaty commented Aug 23, 2012

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.

@mcdonc mcdonc merged commit a30267d into Pylons:master Aug 23, 2012
Pylons Project member
mcdonc commented Aug 23, 2012

Thanks, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.