Exemple #1
0
  def Validate(self, value, key):
    """Check that all parameter names are valid.

    This is used as a validator when parsing conf.yaml.

    Args:
      value: the value to check.
      key: A description of the context for which this value is being
      validated.

    Returns:
      The validated value.
    """
    value = self.regex.Validate(value, key)

    try:
      db.check_reserved_word(value)
    except db.ReservedWordError:
      raise validation.ValidationError(
          'The config parameter name %.100r is reserved by db.Model see: '
          'https://developers.google.com/appengine/docs/python/datastore/'
          'modelclass#Disallowed_Property_Names for details.' % value)

    if value.startswith(RESERVED_MARKER):
      raise validation.ValidationError(
          'The config parameter name %.100r is reserved, as are all names '
          'beginning with \'%s\', please choose a different name.' % (
              value, RESERVED_MARKER))

    return value
Exemple #2
0
    def Validate(self, value, key):
        """Check that all parameter names are valid.

    This is used as a validator when parsing conf.yaml.

    Args:
      value: the value to check.
      key: A description of the context for which this value is being
      validated.

    Returns:
      The validated value.
    """
        value = self.regex.Validate(value, key)

        try:
            db.check_reserved_word(value)
        except db.ReservedWordError:
            raise validation.ValidationError(
                'The config parameter name %.100r is reserved by db.Model see: '
                'https://developers.google.com/appengine/docs/python/datastore/'
                'modelclass#Disallowed_Property_Names for details.' % value)

        if value.startswith(RESERVED_MARKER):
            raise validation.ValidationError(
                'The config parameter name %.100r is reserved, as are all names '
                'beginning with \'%s\', please choose a different name.' %
                (value, RESERVED_MARKER))

        return value