Offer forwards/backwards compatibility for old-style usage of WebHelpers2 select()
storborg opened this issue · comments
The final release of WebHelpers2
changed the select()
semantics for typical lists of (value, label)
. More info here:
https://webhelpers2.readthedocs.org/en/latest/modules/html/tags.html#select-and-options-helpers
Evaluate making a rewrite layer which catches this usage, raises a DeprecationWarning
, and converts to the new format.
Here's a quick example of how to convert the usage:
countries_by_code = [
('us', 'United States'),
('ca', 'Canada'),
('se', 'Sweden'),
('tr', 'Turkey'),
]
# before
from webhelpers.html.tags import *
select('country_code', 'ca', countries_by_code)
# after
from webhelpers2.html.tags import *
select('country_code', 'ca', Options([Option(label, value) for value, label in countries_by_code]))
Done in 440a308