Merge lp:~openerp-dev/openobject-server/7.0-tz-order-change-csn into lp:openobject-server/7.0
Proposed by
Olivier Dony (Odoo)
Status: | Merged |
---|---|
Merged at revision: | 4975 |
Proposed branch: | lp:~openerp-dev/openobject-server/7.0-tz-order-change-csn |
Merge into: | lp:openobject-server/7.0 |
Diff against target: |
12 lines (+2/-1) 1 file modified
openerp/addons/base/res/res_partner.py (+2/-1) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/7.0-tz-order-change-csn |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Dony (Odoo) | Needs Fixing | ||
Review via email: mp+163874@code.launchpad.net |
Description of the change
Fix for bug 1086728: move "Etc/*" timezone entries at the end of the list to avoid confusing users. See the discussion on bug 1086728.
To post a comment you must log in.
@Cedric: Functionally it looks good to me, but technically I think the implementation should be shortened by using the Python API properly. Please use the functional programming aspects of Python as much as possible, it makes the code shorter, more readable, and is much less error-prone (more procedural code such as loops, assignations, etc. means more chances of introducing bugs!)
This patch could basically be a 2-liner, by using a simple sorting function that replaces "Etc/*" by "_" so it is sorted last alphabetically.
# put POSIX 'Etc/*' entries at the end to avoid confusing users - see bug 1086728 pytz.all_ timezones, key=lambda tz: tz if not tz.startswith( 'Etc/') else '_')]
return [(tz,tz) for tz in sorted(
For reference: wiki.python. org/moin/ HowTo/Sorting/ #Key_Functions docs.python. org/2/howto/ functional. html
- Sorting Python lists: http://
- Python functional programming: http://