States and Years ================ This module contains two dictionaries. One where the state names are the key and the abbreviation is the value. And another where the state abbreviation is the key and the name is the value. This module also includes a function to get all years from 1900 to now not including the last 17 years. This is useful if you have a field where the date needs to be 18+ years old. * STATES = Dictionary of state_abbr: state_name * STATES_REV = Dictionary of state_name: state_abbr To get a list of state names, sorted alpha.:: >>> alpha_list = web2py_utils.states_years.states_full() To get a list of state abbreviations, sorted alpha by the state name:: >>> alpha_abbr = web2py_utils.states_years.states_abbr() To get the list of years:: >>> year_list = web2py_utils.states_years.year_list() Alternatively, you can cache these values so that you do not have to re-calculate them every request.:: # Get our states listings as well as year listings >>> STATES_FULL = cache.ram('states_full', states_years.states_full, None) >>> STATES_ABBR = cache.ram('states_abbr', states_years.states_abbr, None) >>> YEAR_LIST = cache.ram('year_list', states_years.year_list, None)