Validate an account_id
495556
def validate(self, meta, val):
        """"""
        val = string_or_int_as_string_spec().normalise(meta, val)
        if not regexes['amazon_account_id'].match(val):
            raise BadOption("Account id must match a particular regex", got=val, should_match=regexes['amazon_account_id'].pattern)
        return val
710712
protected function validate()
    {
        $this->validator
            = substr($this->account, 2, 2) == 99
            ? $this->validator1
            : $this->validatorChain;
    }
1288418
def validate_id_or_name(record_name = nil)
      child_options = IdNameOptionsValidator.build_child_options(record_name)

      validate_options do
        any(*child_options).required
      end
    end
1207479
def __check_valid(self, post_data):
        '''
        
        '''
        user_create_status = {'success': False, 'code': '00'}

        if not tools.check_username_valid(post_data['user_name']):
            user_create_status['code'] = '11'
            return user_create_status
        elif not tools.check_email_valid(post_data['user_email']):
            user_create_status['code'] = '21'
            return user_create_status
        elif MUser.get_by_name(post_data['user_name']):
            user_create_status['code'] = '12'
            return user_create_status
        elif MUser.get_by_email(post_data['user_email']):
            user_create_status['code'] = '22'
            return user_create_status

        user_create_status['success'] = True
        return user_create_status
959216
def validate_login(ctx, param, value):
    """"""
    # pylint: disable=unused-argument
    value = value.strip()
    if not value:
        raise click.BadParameter("The value cannot be blank.", param=param)
    return value
665711
def esr9_format_account_id(account_id)
      (pre, main, post) = account_id.split('-')

      sprintf('%02i%06i%1i', pre.to_i, main.to_i, post.to_i)
    end
1361307
def validate_account_status(self, data):
        
        deleted_status = 'deleted'
        region_status = data.get('status')
        account_status = data.get('account_status')
        for region in region_status:
            if region['status'] != deleted_status and account_status == deleted_status:
                raise ValidationError('Account Status cannot be "deleted" if a region is not "deleted"')
966726
def validate_record(errors_count, row_hash, index)
      record = new(row_hash)
      unless record.valid?
        errors_count += 1
        [nil, errors_count, log_and_return_validation_error(record, row_hash, index)]
      else
        [record, errors_count, nil]
      end
    end
968077
def account_id(self, value):
    
    if type(value) is not str:
      raise TypeError("commit value must be string")
    self._account_id = value
213386
def is_valid(self):
        """"""
        form = super(AuthenticateForm, self).is_valid()
        for f, error in self.errors.items():
            if f != "__all__":
                self.fields[f].widget.attrs.update({"class": "error", "placeholder": ", ".join(list(error))})
            else:
                errors = list(error)
                if "This account is inactive." in errors:
                    message = "Intranet access restricted"
                else:
                    message = "Invalid password"
                self.fields["password"].widget.attrs.update({"class": "error", "placeholder": message})

        return form
832594
def valid?
      return false if @id.nil?
      return false if @date_first.nil?
      return false if @date_next.nil?
      return false if @frequency.nil?
      frequency_validator = EnumAttributeValidator.new('String', ['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
      return false unless frequency_validator.valid?(@frequency)
      return false if @amount.nil?
      return false if @memo.nil?
      return false if @flag_color.nil?
      flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
      return false unless flag_color_validator.valid?(@flag_color)
      return false if @account_id.nil?
      return false if @payee_id.nil?
      return false if @category_id.nil?
      return false if @transfer_account_id.nil?
      return false if @deleted.nil?
      return false if @account_name.nil?
      return false if @payee_name.nil?
      return false if @category_name.nil?
      return false if @subtransactions.nil?
      true
    end
1313750
def search(self, account_name):
        
        accounts = self.list()
        for a in accounts:
            if a['name'] == account_name:
                return a['id']
30982
def validate(self, attrs):
        
        user = authenticate(**self.user_credentials(attrs))

        if user:
            if user.is_active:
                self.instance = user
            else:
                raise serializers.ValidationError(_("This account is currently inactive."))
        else:
            error = _("Invalid login credentials.")
            raise serializers.ValidationError(error)
        return attrs
564091
def validate_id(err, value, source):
    ''

    field_name = '<em:id>' if source == 'install.rdf' else 'id'

    id_pattern = re.compile(
        '('
        # UUID format.
        '\{[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\}'
        '|'
        # "email" format.
        '[a-z0-9-\.\+_]*\@[a-z0-9-\._]+'
        ')',
        re.I)

    err.metadata['id'] = value

    # Must be a valid UUID string.
    if not id_pattern.match(value):
        err.error(
            ('metadata_helpers', '_test_id', 'invalid'),
            'The value of {name} is invalid'.format(name=field_name),
            ['The values supplied for {name} in the {source} file is not a '
             'valid UUID string or email address.'.format(
                 name=field_name, source=source),
             'For help, please consult: '
             'https://developer.mozilla.org/en/install_manifests#id'],
            source)
970483
def validate_item(db, item)
      unless File.exist?("data_bags/#{db}/#{item}.json")
        STDERR.puts "ERROR: data bag '#{db}' item '#{item}' file 'data_bags/#{db}/#{item}.json' does not exist"
        exit(-1)
      end
      f = File.read("data_bags/#{db}/#{item}.json")
      begin
        itemfile = JSON.parse(f)
      rescue JSON::ParserError => e # invalid JSON
        STDERR.puts "ERROR: data bag '#{db} item '#{item}' has JSON errors."
        STDERR.puts e.message
        exit(-1)
      end
      # validate the id matches the file name
      item = item.split("/").last if item =~ /\// # pull out directories

      return if item.eql?(itemfile["id"])

      STDERR.puts "ERROR: data bag '#{db}' item '#{item}' listed in the manifest does not match the id '#{itemfile['id']}' within the 'data_bags/#{db}/#{item}.json' file."
      exit(-1)
    end
988351
def _validate_user(self, user):
        """"""
        # All users allowed
        if self._show_all_users:
            return

        # User specifically allowed
        if user.id in self._allowed_user_ids:
            return

        # User allowed by group membership
        user_member_group_ids = set([g['id'] for g in user._raw['groups']])
        if user_member_group_ids & self._allowed_member_ids:
            return

        raise ValidationError(
            self.record,
            'User `{}` is not a valid selection for field `{}`'.format(
                user,
                self.name
            )
        )
1109485
def validate(self, data):
        
        validator = self._schema.validator(self._id)
        validator.validate(data)