From 95d7cadd7167891c724bafdd9c9828dc640082e6 Mon Sep 17 00:00:00 2001 From: fuzzyman Date: Sun, 22 Nov 2009 00:33:14 +0000 Subject: Implementation of any for Python 2.4 --- configobj.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'configobj.py') diff --git a/configobj.py b/configobj.py index 90ad469..74a376b 100644 --- a/configobj.py +++ b/configobj.py @@ -86,6 +86,15 @@ MISSING = object() __version__ = '4.7.0' +try: + any +except NameError: + def any(iterable): + for entry in iterable: + if entry: + return True + return False + __all__ = ( '__version__', @@ -2246,6 +2255,8 @@ class ConfigObj(Section): section.extra_values = unvalidated if preserve_errors and not section._created: + # If the section wasn't created (i.e. it wasn't missing) + # then we can't return False, we need to preserve errors ret_false = False # if ret_false and preserve_errors and out: -- cgit v1.2.1