##// END OF EJS Templates
get_or_404 method does validation for ID beeing an INT
marcink -
r2942:f53faff4 beta
parent child Browse files
Show More
@@ -118,7 +118,11 class BaseModel(object):
118 118
119 119 @classmethod
120 120 def get_or_404(cls, id_):
121 if id_:
121 try:
122 id_ = int(id_)
123 except (TypeError, ValueError):
124 raise HTTPNotFound
125
122 126 res = cls.query().get(id_)
123 127 if not res:
124 128 raise HTTPNotFound
General Comments 0
You need to be logged in to leave comments. Login now