summaryrefslogtreecommitdiff
path: root/paste/deploy
diff options
context:
space:
mode:
authorianb <devnull@localhost>2007-10-10 00:49:36 +0000
committerianb <devnull@localhost>2007-10-10 00:49:36 +0000
commit2dec17583d165af3e172bc2315e9fca876977eee (patch)
tree39b313111e10e888290efe8b9dc8714a22b7dc80 /paste/deploy
parenta4126b6c2108bff6afbaca1f163cbfdcc7beec26 (diff)
downloadpastedeploy-2dec17583d165af3e172bc2315e9fca876977eee.tar.gz
Added paste.deploy.converters.asint (#155)
Diffstat (limited to 'paste/deploy')
-rw-r--r--paste/deploy/converters.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/paste/deploy/converters.py b/paste/deploy/converters.py
index f0ad349..98edd8f 100644
--- a/paste/deploy/converters.py
+++ b/paste/deploy/converters.py
@@ -12,6 +12,13 @@ def asbool(obj):
"String is not true/false: %r" % obj)
return bool(obj)
+def asint(obj):
+ try:
+ return int(obj)
+ except (TypeError, ValueError), e:
+ raise ValueError(
+ "Bad integer value: %r" % obj)
+
def aslist(obj, sep=None, strip=True):
if isinstance(obj, (str, unicode)):
lst = obj.split(sep)