From 65dcf69e1eb9f16595f1c219af5f86db606d763a Mon Sep 17 00:00:00 2001 From: Nicolas Chauvat Date: Fri, 24 May 2013 20:47:22 +0200 Subject: drop compatibility with python < 2.4 --- configuration.py | 6 +++--- optik_ext.py | 8 +------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/configuration.py b/configuration.py index 4cece55..ef0dc0c 100644 --- a/configuration.py +++ b/configuration.py @@ -498,9 +498,9 @@ class OptionsManagerMixIn(object): # default is handled here and *must not* be given to optik if you # want the whole machinery to work if 'default' in optdict: - if (optparse.OPTPARSE_FORMAT_DEFAULT and 'help' in optdict and - optdict.get('default') is not None and - not optdict['action'] in ('store_true', 'store_false')): + if ('help' in optdict + and optdict.get('default') is not None + and not optdict['action'] in ('store_true', 'store_false')): optdict['help'] += ' [current: %default]' del optdict['default'] args = ['--' + str(opt)] diff --git a/optik_ext.py b/optik_ext.py index 39bbe18..49d685b 100644 --- a/optik_ext.py +++ b/optik_ext.py @@ -65,9 +65,6 @@ try: except ImportError: HAS_MX_DATETIME = False - -OPTPARSE_FORMAT_DEFAULT = sys.version_info >= (2, 4) - from logilab.common.textutils import splitstrip def check_regexp(option, opt, value): @@ -227,10 +224,7 @@ class Option(BaseOption): def process(self, opt, value, values, parser): # First, convert the value(s) to the right type. Howl if any # value(s) are bogus. - try: - value = self.convert_value(opt, value) - except AttributeError: # py < 2.4 - value = self.check_value(opt, value) + value = self.convert_value(opt, value) if self.type == 'named': existant = getattr(values, self.dest) if existant: -- cgit v1.2.1