[web2py] Re: Map database values to display values

2012-06-25 Thread Anthony
> > Do you already have the mapping, perhaps in a dictionary (or can you get >> it into one)? If so, maybe something like: >> >> ISO_COUNTRY_CODE_MAPPINGS = {k: T(v) for (k, v) in original_mapping. >> iteritems()} # requires Python 2.7 >> >> I see. It is still iterating through the whole mapping

[web2py] Re: Map database values to display values

2012-06-25 Thread Daniel Gonzalez
On Monday, June 25, 2012 6:38:47 PM UTC+2, Anthony wrote: > > Do you already have the mapping, perhaps in a dictionary (or can you get > it into one)? If so, maybe something like: > > ISO_COUNTRY_CODE_MAPPINGS = {k: T(v) for (k, v) in original_mapping. > iteritems()} # requires Python 2.7 > > An

[web2py] Re: Map database values to display values

2012-06-25 Thread Anthony
Do you already have the mapping, perhaps in a dictionary (or can you get it into one)? If so, maybe something like: ISO_COUNTRY_CODE_MAPPINGS = {k: T(v) for (k, v) in original_mapping. iteritems()} # requires Python 2.7 Anthony On Monday, June 25, 2012 11:53:24 AM UTC-4, Daniel Gonzalez wrote:

[web2py] Re: Map database values to display values

2012-06-25 Thread Daniel Gonzalez
Yes, that is one of the options I mentioned. If I include all possible countries, my list would have200 entries. I still do not fully understand the process in which modules/views/controllers are loaded when requests are received. But, if I am not completely mistaken, these files are parsed each

[web2py] Re: Map database values to display values

2012-06-25 Thread Anthony
> > 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

[web2py] Re: Map database values to display values

2012-06-25 Thread Daniel Gonzalez
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 v

[web2py] Re: Map database values to display values

2012-06-25 Thread Anthony
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 b