Changeset - f53faff4487e
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-10-19 23:44:35
marcin@python-works.com
get_or_404 method does validation for ID beeing an INT
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -118,7 +118,11 @@ class BaseModel(object):
 

	
 
    @classmethod
 
    def get_or_404(cls, id_):
 
        if id_:
 
        try:
 
            id_ = int(id_)
 
        except (TypeError, ValueError):
 
            raise HTTPNotFound
 

	
 
            res = cls.query().get(id_)
 
            if not res:
 
                raise HTTPNotFound
0 comments (0 inline, 0 general)