Commit 3fb8680a authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

rapi: Add default parameter to _checkIntVariable


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b4a9eb66
......@@ -233,16 +233,16 @@ class R_Generic(object):
"""
return self.sn
def _checkIntVariable(self, name):
def _checkIntVariable(self, name, default=0):
"""Return the parsed value of an int argument.
"""
val = self.queryargs.get(name, 0)
val = self.queryargs.get(name, default)
if isinstance(val, list):
if val:
val = val[0]
else:
val = 0
val = default
try:
val = int(val)
except (ValueError, TypeError):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment