Show More
@@ -118,11 +118,15 b' 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 |
|
|
122 | id_ = int(id_) | |
123 | if not res: |
|
123 | except (TypeError, ValueError): | |
124 |
|
|
124 | raise HTTPNotFound | |
125 | return res |
|
125 | ||
|
126 | res = cls.query().get(id_) | |||
|
127 | if not res: | |||
|
128 | raise HTTPNotFound | |||
|
129 | return res | |||
126 |
|
130 | |||
127 | @classmethod |
|
131 | @classmethod | |
128 | def getAll(cls): |
|
132 | def getAll(cls): |
General Comments 0
You need to be logged in to leave comments.
Login now