Revision 3fb8680a
b/lib/rapi/baserlib.py | ||
---|---|---|
233 | 233 |
""" |
234 | 234 |
return self.sn |
235 | 235 |
|
236 |
def _checkIntVariable(self, name): |
|
236 |
def _checkIntVariable(self, name, default=0):
|
|
237 | 237 |
"""Return the parsed value of an int argument. |
238 | 238 |
|
239 | 239 |
""" |
240 |
val = self.queryargs.get(name, 0)
|
|
240 |
val = self.queryargs.get(name, default)
|
|
241 | 241 |
if isinstance(val, list): |
242 | 242 |
if val: |
243 | 243 |
val = val[0] |
244 | 244 |
else: |
245 |
val = 0
|
|
245 |
val = default
|
|
246 | 246 |
try: |
247 | 247 |
val = int(val) |
248 | 248 |
except (ValueError, TypeError): |
Also available in: Unified diff