On Monday, June 25, 2012 4:45:22 PM UTC+2, Anthony wrote: > > Check out the IS_IN_SET documentation at > http://web2py.com/books/default/chapter/29/7. Instead of a list of > individual items, it can be a list of two-tuples or a dictionary, where the > first tuple item or dictionary key is the value and the second tuple item > or dictionary value is the label to be displayed in the select widget. > > Anthony > > Thanks, this worked. For othesr who might have the same problem, this is what I have done:
ISO_COUNTRY_CODES_MAPPING = { 'DE': 'Germany', 'ES': 'Spain', 'IT': 'Italy', 'US': 'United States' } ... member.country.requires = IS_IN_SET(ISO_COUNTRY_CODES_MAPPING) Now, to support internationalization here, I see two options: - I implement a function which returns the desired predefined mapping, according to the language of the user. How can I know this? How does the T operator know this? - I walk the list of ISO country codes applying the T operator to return the mapping. Since it is not clear for me when this mapping will be created (at startup? in each request?) I do not understand the performance implications. Maybe somebody can comment. Thanks, Daniel --