[buildinfo.debian.net] 02/02: Tidy rejection of supported formats.

Chris Lamb chris at chris-lamb.co.uk
Mon Mar 27 19:24:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository buildinfo.debian.net.

commit 0500a32f6c63c81c8ca2bb3312ac51d9e5a54bdf
Author: Chris Lamb <lamby at debian.org>
Date:   Mon Mar 27 20:17:59 2017 +0100

    Tidy rejection of supported formats.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 bidb/api/utils.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/bidb/api/utils.py b/bidb/api/utils.py
index 82b3fc5..07058e4 100644
--- a/bidb/api/utils.py
+++ b/bidb/api/utils.py
@@ -77,15 +77,12 @@ def parse_submission(request):
         except KeyError:
             raise InvalidSubmission("Missing required field: {}".format(field))
 
-    try:
-        version = data.get('Format')
-    except KeyError:
-        raise InvalidSubmission("Missing 'Format' header")
-
-    if version not in SUPPORTED_FORMATS:
-        raise InvalidSubmission("Only {} format versions are supported".format(
-            ', '.join(sorted(SUPPORTED_FORMATS)),
-        ))
+    if data.get('Format') not in SUPPORTED_FORMATS:
+        raise InvalidSubmission(
+            "Only {} 'Format:'  versions are supported".format(
+                ', '.join(sorted(SUPPORTED_FORMATS)),
+            )
+        )
 
     buildinfo = Buildinfo.objects.create(
         sha1=sha1,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/buildinfo.debian.net.git



More information about the Reproducible-commits mailing list