On Fri, Dec 11, 2009 at 10:55 PM, Preston Holmes <pres...@ptone.com> wrote:
> Well something wonky is going on.
>
> From my readthrough of the code, it *should* get called on empty
> formsets:
>
> is_valid calls total_form_count to get a loop count
> total_form_count should be positive even if forms are blank
>
> is_valid then accesses form.errors inside that loop
> (django.forms.formsets.py 1.1.1 #237 if bool(self.errors[i]))
>
> accessing form.errors should run _get_errors()
> which calls full_clean()
> which calls clean()
>
> What about if you do
>
> formset3.is_valid()
>
> then
>
> formset3._errors
>
> this will access the current errors without triggering the full_clean
>
> If it is None - than validation is not triggering an access to the
> property function as it should
>
> -Preston
>

I don't see why total_form_count should be positive. The edge case is
for a formset with zero forms, not a formset with 'more than zero'
empty forms.
In this case, total_form_count will always be zero, the loop is never
entered, and the contract to validate/clean the formset when
Formset::is_valid() is called is ignored.

Cheers

Tom

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to