Mercurial > babel > mirror
annotate scripts/dump_global.py @ 590:6f86d60dab56 trunk
change repr output for babel.Locale so all attributes (territory, script, variant) are shown by itself. This should help identifying bad usage of the Locale class (e.g. Locale('de_DE') instead of Locale('de', 'DE'), #279
author | fschwarz |
---|---|
date | Thu, 09 Aug 2012 06:56:23 +0000 |
parents | 1de26da5aa25 |
children |
rev | line source |
---|---|
233 | 1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- | |
3 # | |
530 | 4 # Copyright (C) 2007-2011 Edgewall Software |
233 | 5 # All rights reserved. |
6 # | |
7 # This software is licensed as described in the file COPYING, which | |
8 # you should have received as part of this distribution. The terms | |
9 # are also available at http://babel.edgewall.org/wiki/License. | |
10 # | |
11 # This software consists of voluntary contributions made by many | |
12 # individuals. For the exact contribution history, see the revision | |
13 # history and logs, available at http://babel.edgewall.org/log/. | |
14 | |
549
1de26da5aa25
use cPickle instead of pickle for better performance (fixes #225)
fschwarz
parents:
530
diff
changeset
|
15 import cPickle as pickle |
233 | 16 import os |
17 from pprint import pprint | |
18 import sys | |
19 | |
20 import babel | |
21 | |
22 dirname = os.path.join(os.path.dirname(babel.__file__)) | |
23 filename = os.path.join(dirname, 'global.dat') | |
24 fileobj = open(filename, 'rb') | |
25 try: | |
26 data = pickle.load(fileobj) | |
27 finally: | |
28 fileobj.close() | |
29 | |
30 if len(sys.argv) > 1: | |
31 pprint(data.get(sys.argv[1])) | |
32 else: | |
33 pprint(data) |