##// 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 @classmethod
119 @classmethod
120 def get_or_404(cls, id_):
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 res = cls.query().get(id_)
126 res = cls.query().get(id_)
123 if not res:
127 if not res:
124 raise HTTPNotFound
128 raise HTTPNotFound
General Comments 0
You need to be logged in to leave comments. Login now