annotate bio/flags.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents 89b240fe9297
children
rev   line source
bgneal@609 1 """
bgneal@609 2 This module contains country flag data & functions.
bgneal@609 3
bgneal@609 4 """
bgneal@679 5 import json
bgneal@609 6 import os.path
bgneal@609 7 import locale
bgneal@609 8 import logging
bgneal@609 9
bgneal@609 10
bgneal@609 11 # Read flag data from external JSON file:
bgneal@609 12
bgneal@609 13 FLAG_DATA = {}
bgneal@609 14
bgneal@609 15 datafile = os.path.join(os.path.split(__file__)[0], 'flag_data.json')
bgneal@609 16
bgneal@609 17 try:
bgneal@609 18 with open(datafile, 'r') as fp:
bgneal@609 19 FLAG_DATA = json.load(fp, encoding='utf-8')
bgneal@609 20 except IOError:
bgneal@609 21 FLAG_DATA = {}
bgneal@609 22 logging.error("Could not load flag_data.json")
bgneal@609 23
bgneal@609 24 # Build a choices list for use with Django models, etc.
bgneal@609 25 # The locale is set in order to sort the place names correctly:
bgneal@609 26
bgneal@609 27 locale.setlocale(locale.LC_ALL, '')
bgneal@609 28
bgneal@609 29 FLAG_CHOICES = sorted(FLAG_DATA.items(),
bgneal@609 30 cmp=lambda lhs, rhs: locale.strcoll(lhs[1], rhs[1]))