Mercurial > babel > mirror
annotate babel/compat.py @ 591:d1618dfaf114 trunk
change Locale comparison: Locales are now considered equal if all of their attributes (language, territory, script, variant) are equal. Before __eq__ used the simple string representation which hides errors in Locale instantiation (see #279 and #311 for more information).
author | fschwarz |
---|---|
date | Thu, 09 Aug 2012 07:36:36 +0000 |
parents | 8ce41e60f90d |
children |
rev | line source |
---|---|
567
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
2 # |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
3 # Copyright (C) 2007-2011 Edgewall Software |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
4 # All rights reserved. |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
5 # |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
6 # This software is licensed as described in the file COPYING, which |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
7 # you should have received as part of this distribution. The terms |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
8 # are also available at http://babel.edgewall.org/wiki/License. |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
9 # |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
10 # This software consists of voluntary contributions made by many |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
11 # individuals. For the exact contribution history, see the revision |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
12 # history and logs, available at http://babel.edgewall.org/log/. |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
13 |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
14 try: |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
15 any = any |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
16 except NameError: |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
17 def any(iterable): |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
18 return filter(None, list(iterable)) |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
19 |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
20 try: |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
21 import threading |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
22 except ImportError: |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
23 import dummy_threading as threading |
c81a11cb1476
add a compat module to shield the code from changes in different versions of Python
fschwarz
parents:
diff
changeset
|
24 |