Mercurial > p > roundup > code
comparison roundup/rest.py @ 7372:886a5c767d7e
Invalid REST item spec returns 404 rather than 400.
A GET to /rest/data/issue/issue4 now returns a 404 rather than a 400
status code.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 17 May 2023 22:20:12 -0400 |
| parents | 5159d8ea585a |
| children | 5775d2c4a846 |
comparison
equal
deleted
inserted
replaced
| 7371:a210f4437b49 | 7372:886a5c767d7e |
|---|---|
| 1000 ): | 1000 ): |
| 1001 raise Unauthorised( | 1001 raise Unauthorised( |
| 1002 'Permission to view %s%s.%s denied' | 1002 'Permission to view %s%s.%s denied' |
| 1003 % (class_name, item_id, keyprop) | 1003 % (class_name, item_id, keyprop) |
| 1004 ) | 1004 ) |
| 1005 itemid = class_obj.lookup(v) | 1005 try: |
| 1006 itemid = class_obj.lookup(v) | |
| 1007 except TypeError: | |
| 1008 raise NotFound("Item '%s' not found" % v) | |
| 1009 | |
| 1006 if not self.db.security.hasPermission( | 1010 if not self.db.security.hasPermission( |
| 1007 'View', uid, class_name, itemid=itemid | 1011 'View', uid, class_name, itemid=itemid |
| 1008 ): | 1012 ): |
| 1009 raise Unauthorised( | 1013 raise Unauthorised( |
| 1010 'Permission to view %s%s denied' % (class_name, itemid) | 1014 'Permission to view %s%s denied' % (class_name, itemid) |
