comparison babel/localedata.py @ 546:b33c36615fe9

rename babel.localedata.list() to ease Python 3 transition (fixes #250)
author fschwarz
date Sat, 19 Mar 2011 19:48:23 +0000
parents 85e1beadacb0
children 423bb50cb8af
comparison
equal deleted inserted replaced
545:afdab04b8527 546:b33c36615fe9
23 import threading 23 import threading
24 except ImportError: 24 except ImportError:
25 import dummy_threading as threading 25 import dummy_threading as threading
26 from UserDict import DictMixin 26 from UserDict import DictMixin
27 27
28 __all__ = ['exists', 'list', 'load'] 28 __all__ = ['exists', 'locale_identifiers', 'load']
29 __docformat__ = 'restructuredtext en' 29 __docformat__ = 'restructuredtext en'
30 30
31 _cache = {} 31 _cache = {}
32 _cache_lock = threading.RLock() 32 _cache_lock = threading.RLock()
33 _dirname = os.path.join(os.path.dirname(__file__), 'localedata') 33 _dirname = os.path.join(os.path.dirname(__file__), 'localedata')
43 if name in _cache: 43 if name in _cache:
44 return True 44 return True
45 return os.path.exists(os.path.join(_dirname, '%s.dat' % name)) 45 return os.path.exists(os.path.join(_dirname, '%s.dat' % name))
46 46
47 47
48 def list(): 48 def locale_identifiers():
49 """Return a list of all locale identifiers for which locale data is 49 """Return a list of all locale identifiers for which locale data is
50 available. 50 available.
51 51
52 :return: a list of locale identifiers (strings) 52 :return: a list of locale identifiers (strings)
53 :rtype: `list` 53 :rtype: `list`
Copyright (C) 2012-2017 Edgewall Software