diff 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
line wrap: on
line diff
--- a/roundup/rest.py	Wed May 17 13:34:36 2023 -0400
+++ b/roundup/rest.py	Wed May 17 22:20:12 2023 -0400
@@ -1002,7 +1002,11 @@
                     'Permission to view %s%s.%s denied'
                     % (class_name, item_id, keyprop)
                 )
-            itemid = class_obj.lookup(v)
+            try:
+                itemid = class_obj.lookup(v)
+            except TypeError:
+                raise NotFound("Item '%s' not found" % v)
+
         if not self.db.security.hasPermission(
             'View', uid, class_name, itemid=itemid
         ):

Roundup Issue Tracker: http://roundup-tracker.org/