From f102cb21d9480254baca61167169459c7cbe05b4 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 11 Jun 2008 21:11:36 +0000 Subject: [PATCH] fix by Anders Holst: optimize ConfigInteger clamping --- lib/python/Components/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 1757ef40..b0f5fe6d 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -363,11 +363,11 @@ class ConfigSequence(ConfigElement): for i in self._value: max_pos += len(str(self.limits[num][1])) - while self._value[num] < self.limits[num][0]: - self._value[num] += 1 + if self._value[num] < self.limits[num][0]: + self._value[num] = self.limits[num][0] - while self._value[num] > self.limits[num][1]: - self._value[num] -= 1 + if self._value[num] > self.limits[num][1]: + self._value[num] = self.limits[num][1] num += 1 @@ -517,7 +517,7 @@ class ConfigClock(ConfigSequence): ConfigSequence.__init__(self, seperator = ":", limits = [(0,23),(0,59)], default = [t.tm_hour, t.tm_min]) class ConfigInteger(ConfigSequence): - def __init__(self, default, limits = (0, 10000000000)): + def __init__(self, default, limits = (0, 9999999999)): ConfigSequence.__init__(self, seperator = ":", limits = [limits], default = default) # you need to override this to do input validation -- 2.30.2