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 |
|
|
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