From 8cd39a445e71c9f105d75d5ea6a94f9492a1ee20 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 26 Dec 2008 11:18:58 +0100 Subject: [PATCH] [IMP] allow methods 'all' and 'any' to be available with python 2.4 bzr revid: christophe@taupe-20081226101858-vfzy8x6blf2vmf6h --- bin/tools/misc.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index ac5f8695149..933274ddf0c 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -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={