From 3699aa51018d4a3a5388aa42e8477cb70b15e95f Mon Sep 17 00:00:00 2001 From: Catherine Diep Date: Tue, 22 Nov 2016 16:24:01 -0800 Subject: [PATCH] Disallow creation of product version with empty version name. A product version with version name equals to null/empty/blank is implicitly created with the product. This patch disallows users to create versions with empty name. Change-Id: Iad477e486e23415ce20a9cd9367b9ef1a97173a4 --- refstack/api/validators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/refstack/api/validators.py b/refstack/api/validators.py index 48bc3dd8..8baa4420 100644 --- a/refstack/api/validators.py +++ b/refstack/api/validators.py @@ -250,3 +250,6 @@ class ProductVersionValidator(BaseValidator): def validate(self, request): """Validate product version data.""" super(ProductVersionValidator, self).validate(request) + body = json.loads(request.body) + + self.check_emptyness(body, ['version'])