Synchronously check an individual field against a rule.
428840
function checkSync(validations, input, key) {
  var arr = new Checkit(validations).runSync(input);
  if (arr[0] === null) return arr;
  if (arr[0] instanceof CheckitError) {
    return [arr[0].get(key), null]
  }
  return arr;
}
829802
def on_rule(self, *args):
        """"""
        if self.rule is None:
            return
        self.rule.connect(self._listen_to_rule)
110260
def __validate_logical(self, operator, definitions, field, value):
        
        valid_counter = 0
        _errors = errors.ErrorList()

        for i, definition in enumerate(definitions):
            schema = {field: definition.copy()}
            for rule in ('allow_unknown', 'type'):
                if rule not in schema[field] and rule in self.schema[field]:
                    schema[field][rule] = self.schema[field][rule]
            if 'allow_unknown' not in schema[field]:
                schema[field]['allow_unknown'] = self.allow_unknown

            validator = self._get_child_validator(
                schema_crumb=(field, operator, i),
                schema=schema, allow_unknown=True)
            if validator(self.document, update=self.update, normalize=False):
                valid_counter += 1
            else:
                self._drop_nodes_from_errorpaths(validator._errors, [], [3])
                _errors.extend(validator._errors)

        return valid_counter, _errors
164425
def check_unique(self):
        """"""
        errors = []
        service_id = getattr(self, 'id', None)
        fields = [('location', views.service_location),
                  ('name', views.service_name)]

        for field, view in fields:
            value = getattr(self, field, None)
            if not value:
                continue

            result = yield view.values(key=value)
            matched = {x['id'] for x in result if x['id'] != service_id}
            if matched:
                errors.append("Service with {} '{}' already exists"
                              .format(field, value))

        if errors:
            raise exceptions.ValidationError(errors)
882936
function( field, resque ) {
					if ( field.attr( "name" ) === undefined && field.attr( "id" ) === undefined ) {
						return false;
					}
					var name = field.attr( "name" );
					if ( field.is( ":checkbox" ) && resque !== "false" && ( name === undefined || name.indexOf( "[" ) === -1 ) ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.prop( "checked", true );
					} else if( field.is( ":checkbox" ) && resque === "false" && ( name === undefined || name.indexOf( "[" ) === -1 ) ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.prop( "checked", false );
					} else if ( field.is( ":radio" ) ) {
						if ( field.val() === resque ) {
							field.prop( "checked", true );
						}
					} else if ( name === undefined || name.indexOf( "[" ) === -1 ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.val( resque );
					} else {
						resque = resque.split( "," );
						field.val( resque );
					}
				}
989594
def validate(self):
        """"""
        # check if required_fields aren't present
        for field in set(self.required_fields) - set(self.request_data):
            if not isinstance(field, string_types):
                # field was a collection, iterate over it and check by OR
                return bool(set(field) & set(self.request_data))
            return False
        return True
543005
def _in(field, filter_value):
        
        valid = False
        if field in filter_value:
            valid = True
        return valid
167605
def check_relations(self, relations):
        """"""
        for rel in relations:
            if not rel:
                continue
            fields = rel.split('.', 1)

            local_field = fields[0]
            if local_field not in self.fields:
                raise ValueError('Unknown field "{}"'.format(local_field))

            field = self.fields[local_field]
            if not isinstance(field, BaseRelationship):
                raise ValueError('Can only include relationships. "{}" is a "{}"'
                                 .format(field.name, field.__class__.__name__))

            field.include_data = True
            if len(fields) > 1:
                field.schema.check_relations(fields[1:])
606326
function (field, error) {

                if (field instanceof Object) {
                    this.$errors.set(field);
                } else {
                    this.$errors.set(field, error);
                }

                this.trigger('isValidChanged');
            }
370788
def execute_once(self, string):
        """"""
        for rule in self.rules:
            if rule[0] in string:
                pos = string.find(rule[0])
                self.last_rule = rule
                return string[:pos] + rule[1] + string[pos+len(rule[0]):]
        self.last_rule = None
        return string
927130
def _ensure_field(self, key):
        """"""
        if self._has_field:
            self._size += 2  # comma, space
        self._has_field = True

        self._size += len(key) + 4
808656
def _checker(keywords):
    """"""
    def _(v):
        """Check a given value matches to keywords."""
        for k in keywords:
            if k in v:
                return False
        return True
    return _
885407
def check(self, check_all=True, do_reload=True):
        """"""
        with enaml.imports():
            super(EnamlReloader, self).check(check_all=check_all, do_reload=do_reload)
659261
def __check_field(self, key):
        """"""
        if not self._props.get(key):
            raise KeyError(
                'The field "%s" does not exist on "%s"' % (
                    key, self.__class__.__name__,
                ),
            )
4847
def validatePrivate(self, field, value) :
        """"""
        if field not in self.arangoPrivates :
            raise ValueError("%s is not a private field of collection %s" % (field, self))

        if field in self._fields :
            self._fields[field].validate(value)
        return True
654931
def check_value(self, value):
        """"""
        #if self.readonly:
        #    raise error.Error(
        #        "'{field_name}' field is readonly".format(
        #            field_name=self.name))
        if value and self.size:
            if not is_string(value):
                raise ValueError("Value supplied has to be a string")
            if len(value) > self.size:
                raise ValueError(
                    "Lenght of the '{0}' is limited to {1}".format(
                        self.name, self.size))
        if not value and self.required:
            raise ValueError("'{0}' field is required".format(self.name))
        return value
863575
protected void synchronizeField(QueryPage queryPage, List<String> options, String fieldName, String fieldCaption, Boolean mandatory) {
    QueryFieldDAO queryFieldDAO = new QueryFieldDAO();
    QueryOptionFieldDAO queryOptionFieldDAO = new QueryOptionFieldDAO();

    QueryOptionField queryField = (QueryOptionField) queryFieldDAO.findByQueryPageAndName(queryPage, fieldName);
    if (queryField != null) {
      queryFieldDAO.updateMandatory(queryField, mandatory);
      queryFieldDAO.updateCaption(queryField, fieldCaption);
    } else {
      queryField = queryOptionFieldDAO.create(queryPage, fieldName, mandatory, fieldCaption);
    }

    synchronizeFieldOptions(options, queryField);
  }