From 94a98f740c71fafbab464e2e0052288f452620ed Mon Sep 17 00:00:00 2001
From: anonymous <anonymous>
Date: Tue, 23 Apr 2019 14:44:04 +0200
Subject: [PATCH] fix group validation

---
 ckanext/odsh/validation.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ckanext/odsh/validation.py b/ckanext/odsh/validation.py
index 06de6824..1233070a 100644
--- a/ckanext/odsh/validation.py
+++ b/ckanext/odsh/validation.py
@@ -52,7 +52,8 @@ def validate_extra_groups(data, requireAtLeastOne, errors):
             data[('groups', num, 'id')] = group
     else: # no extra-field 'groups'
         # dataset might come from a harvest process
-        if not data.get(('groups', 0, 'id'), False):
+        if not data.get(('groups', 0, 'id'), False) and not \
+            (data.get('groups', False) and len(data.get('groups'))>0):
             errors['groups']= 'at least one group needed'
 
 def validate_extras(key, data, errors, context):
-- 
GitLab