lib/bureaucrat/forms.rb
# Runs all the validations for this form. If the form is invalid
# the list of errors is populated, if it is valid, cleaned_data is
# populated
Runs all the validations for this form. If the form is invalid
the list of errors is populated, if it is valid, cleaned_data is
populated
Runs all the validations for this form . If the form is invalid the list of errors is populated if it is valid cleaned_data is populated
def full_clean
        @errors = Fields::ErrorHash.new
        return unless bound?
        @cleaned_data = StringAccessHash.new
        return if empty_permitted? && !changed?
        @fields.each do |name, field|
          value = field.widget.
            value_from_formdata(@data, add_prefix(name))
          begin
            if field.is_a?(Fields::FileField)
              initial = @initial.fetch(name, field.initial)
              @cleaned_data[name] = field.clean(value, initial)
            else
              @cleaned_data[name] = field.clean(value)
            end
            clean_method = 'clean_%s' % name
            @cleaned_data[name] = send(clean_method) if respond_to?(clean_method)
          rescue ValidationError => e
            @errors[name] = e.messages
            @cleaned_data.delete(name)
          end
        end
        begin
          @cleaned_data = clean
        rescue ValidationError => e
          @errors[:__NON_FIELD_ERRORS] = e.messages
        end
        @cleaned_data = nil if @errors && !@errors.empty?
      end
def full_clean @errors = Fields :: ErrorHash . new return unless bound? @cleaned_data = StringAccessHash . new return if empty_permitted? && ! changed? @fields . each do | name , field | value = field . widget . value_from_formdata ( @data , add_prefix ( name ) ) begin if field . is_a? ( Fields :: FileField ) initial = @initial . fetch ( name , field . initial ) @cleaned_data [ name ] = field . clean ( value , initial ) else @cleaned_data [ name ] = field . clean ( value ) end clean_method = 'clean_%s' % name @cleaned_data [ name ] = send ( clean_method ) if respond_to? ( clean_method ) rescue ValidationError => e @errors [ name ] = e . messages @cleaned_data . delete ( name ) end end begin @cleaned_data = clean rescue ValidationError => e @errors [ :__NON_FIELD_ERRORS ] = e . messages end @cleaned_data = nil if @errors && ! @errors . empty? end
Runs all the validations for this form.
Runs all the validations for this form .