diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-07-07 12:02:33 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-07-07 12:02:33 +0100 |
commit | 3c539e1c7b37f772d67f4eaf95c590030f91bcc1 (patch) | |
tree | 9ecd7852bae9a94a4afb55d5c2a84560caeaa179 /alot/settings | |
parent | ff493ee46493b832d5e42c14372873c057332d40 (diff) |
fix with_tuple configobj check
make sure it always returns a tuple
Diffstat (limited to 'alot/settings')
-rw-r--r-- | alot/settings/checks.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/alot/settings/checks.py b/alot/settings/checks.py index eff1370e..ca412b68 100644 --- a/alot/settings/checks.py +++ b/alot/settings/checks.py @@ -62,19 +62,28 @@ def width_tuple(value): """ test if value is a valid width indicator (for a sub-widget in a column). This can either be - ('fit', min, max): use the length actually needed for the content, padded to - use at least width min, and cut of at width max. Here, min - and max are positive integers or 0 to disable the boundary. + ('fit', min, max): use the length actually needed for the content, padded + to use at least width min, and cut of at width max. + Here, min and max are positive integers or 0 to disable + the boundary. ('weight',n): have it relative weight of n compared to other columns. Here, n is an int. """ if value is None: - value = 'fit',0,0 + res = 'fit', 0, 0 elif not isinstance(value, (list, tuple)): raise VdtTypeError(value) elif value[0] not in ['fit', 'weight']: raise VdtTypeError(value) - return value + if value[0] == 'fit': + if not isinstance(value[1], int) or not isinstance(value[2], int): + VdtTypeError(value) + res = 'fit', int(value[1]), int(value[2]) + else: + if not isinstance(value[1], int): + VdtTypeError(value) + res = 'weight', int(value[1]) + return res def mail_container(value): |