request.intargs(i,default,url_onerror=URL(...))

This commit is contained in:
Massimo Di Pierro
2012-04-29 18:51:04 -05:00
parent 32b77ac223
commit 85f8dc6d5b
3 changed files with 11 additions and 2 deletions
+9
View File
@@ -94,6 +94,15 @@ class Request(Storage):
self.is_local = False
self.global_settings = settings.global_settings
def intargs(self,n,default=None,url_onerror=None):
k = self.args(n) or default
try:
return int(k)
except (ValueError, TypeError):
if url_onerror:
redirect(url_onerror)
raise HTTP(404)
def compute_uuid(self):
self.uuid = '%s/%s.%s.%s' % (
self.application,