From ae85b67cf653ba7e9937ff241d2062047069ff71 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 10 Dec 2014 16:37:07 +0000 Subject: [PATCH] Add integer type to config schema svn path=/dists/trunk/linux/; revision=22182 --- debian/lib/python/debian_linux/config.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/lib/python/debian_linux/config.py b/debian/lib/python/debian_linux/config.py index e1a8d17cf..79ef425f9 100644 --- a/debian/lib/python/debian_linux/config.py +++ b/debian/lib/python/debian_linux/config.py @@ -27,6 +27,14 @@ class SchemaItemBoolean(object): raise Error +class SchemaItemInteger(object): + def __call__(self, i): + try: + return int(i.strip(), 0) + except ValueError: + raise Error + + class SchemaItemList(object): def __init__(self, type="\s+"): self.type = type