parameters: (self)
docstring: Validates form fields that depend on each other
docstring_summary: Validates form fields that depend on each other
docstring_tokens: Validates form fields that depend on each other
function: def clean(self):
          """Validates form fields that depend on each other"""
          super().clean()
          url = self.cleaned_data.get("url")
          service_type = self.cleaned_data.get("type")
          if url is not None and service_type is not None:
              try:
                  service_handler = get_service_handler(
                      base_url=url, service_type=service_type)
              except Exception as e:
                  logger.error(f"CreateServiceForm cleaning error: {e}")
                  raise ValidationError(
                      _("Could not connect to the service at %(url)s"),
                      params={"url": url}
                  )
              if not service_handler.probe():
                  raise ValidationError(
                      _("Could not connect to the service at %(url)s"),
                      params={"url": url}
                  )
              elif service_type not in (enumerations.AUTO, enumerations.OWS):
                  if service_handler.service_type != service_type:
                      raise ValidationError(
                          _("Found service of type %(found_type)s instead "
                            "of %(service_type)s"),
                          params={
                              "found_type": service_handler.service_type,
                              "service_type": service_type
                          }
                      )
              self.cleaned_data["service_handler"] = service_handler
              self.cleaned_data["type"] = service_handler.service_type
function_tokens: def clean ( self ) : super ( ) . clean ( ) url = self . cleaned_data . get ( "url" ) service_type = self . cleaned_data . get ( "type" ) if url is not None and service_type is not None : try : service_handler = get_service_handler ( base_url = url , service_type = service_type ) except Exception as e : logger . error ( f"CreateServiceForm cleaning error: {e}" ) raise ValidationError ( _ ( "Could not connect to the service at %(url)s" ) , params = { "url" : url } ) if not service_handler . probe ( ) : raise ValidationError ( _ ( "Could not connect to the service at %(url)s" ) , params = { "url" : url } ) elif service_type not in ( enumerations . AUTO , enumerations . OWS ) : if service_handler . service_type != service_type : raise ValidationError ( _ ( "Found service of type %(found_type)s instead " "of %(service_type)s" ) , params = { "found_type" : service_handler . service_type , "service_type" : service_type } ) self . cleaned_data [ "service_handler" ] = service_handler self . cleaned_data [ "type" ] = service_handler . service_type