def validate_review_groups(form, field=u'review_groups'):
 groups = form.cleaned_data.get(field, [])
 local_site = form.cleaned_data[u'local_site']
 for group in groups:
  if (group.local_site != local_site):
   raise ValidationError([(_(u'The review group %s does not exist.') % group.name)])
 return groups

def validate_review_groups ( form , field = u'review_groups' ) : groups = form . cleaned_data . get ( field , [ ] ) local_site = form . cleaned_data [ u'local_site' ] for group in groups : if ( group . local_site != local_site ) : raise ValidationError ( [ ( _ ( u'The review group %s does not exist.' ) % group . name ) ] ) return groups
validates that the review groups all have valid .