[IMP] allow methods 'all' and 'any' to be available with python 2.4

bzr revid: christophe@taupe-20081226101858-vfzy8x6blf2vmf6h
This commit is contained in:
Christophe Simonis 2008-12-26 11:18:58 +01:00
parent 3c16899b99
commit 8cd39a445e
1 changed files with 23 additions and 0 deletions

View File

@ -664,6 +664,29 @@ def ustr(value):
return unicode(value, 'utf-8')
# to be compatible with python 2.4
import __builtin__
if not hasattr(__builtin__, 'all'):
def all(iterable):
for element in iterable:
if not element:
return False
return True
__builtin__.all = all
del all
if not hasattr(__builtin__, 'any'):
def any(iterable):
for element in iterable:
if element:
return True
return False
__builtin__.any = any
del any
def get_languages():
languages={