def verify_baseUrl(self, name, required, scheme_optional=False):
    try:
      value = self.__bindings.get(name)
    except KeyError:
      if not required:
        return True
      self.__errors.append('Missing "{name}".'.format(name=name))
      return False
      
    if self.is_reference(value):
      if not required:
        return True
      self.__errors.append('Missing "{name}".'.format(name=name))
      return False

    # We don't really need a full URL since we're validating base urls,
    # (without query parameters and fragments), so the scheme will be optional.
    scheme_token = '[a-z0-9]+'
    host_token = _host_regex_token()
    port_token = '[1-9][0-9]*'
    path_token = '(?:[-\._+a-zA-Z0-9]|(?:%[0-9a-fA-F]{2}))+'
    url_re = re.compile('^'
                          '({scheme}://){scheme_optional}'
                          '({host})(:{port})?'
                          '((?:/{path})*/?)'
                        '$'
                        .format(
                          scheme=scheme_token,
                          scheme_optional = '?' if scheme_optional else '',
                          host=host_token,
                          port=port_token,
                          path=path_token
                        ))
    match = url_re.match(value)
    return match != None
RESTful CRUD controller
dataset/ETHPy150Open spinnaker/spinnaker/pylib/spinnaker/validate_configuration.py/ValidateConfig.verify_baseUrl--crossover with--dataset/ETHPy150Open sahana/eden/controllers/msg.py/group