

def clean_default_service(self):
    'Clean the default_service field.\n\n        Raises:\n            django.core.exceptions.ValidationError:\n                Raised if an unknown service or disabled service is set to be\n                the default.\n        '
    enabled_services = set(self.cleaned_data['enabled_services'])
    service_id = self.cleaned_data['default_service']
    if (service_id == 'none'):
        default_service = None
    else:
        if (not avatar_services.has_service(service_id)):
            raise ValidationError(('Unknown service "%s".' % service_id))
        elif (service_id not in enabled_services):
            raise ValidationError(('Cannot set disabled service "%s" to default.' % service_id))
        default_service = avatar_services.get('avatar_service_id', service_id)
    return default_service

dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/admin/forms.py AvatarServicesForm.clean_default_service/original