On 12/30/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:
On 12/29/06, Vadim Macagon <[EMAIL PROTECTED]> wrote: > > Adrian Holovaty wrote: > > > > Would it help if the form automatically called its validation the > > first time you accessed form.clean_data? I'm trying to decide whether > > that would be convenient or too magic. > > > > I kind of like the way it is now, if form.clean_data did the validation > on first access how would you tell if the validation was successful? > You'd have to call form.is_valid() anyway, so it seems logical to me not > to try to access form.clean_data before checking if validation > succeeded. If it's not valid you probably have to redisplay the form > anyway, so no point doing extra work processing clean_data that will get > discarded. > My thought exactly. I couldn't have said it better myself. Although, I will admit that my confusion came from thinking that accessing form.clean_data would call the validation. However, that could be attributed to the current lack of documentation (a problem that will no doubt be addressed soon) than anything else. And once I got the logic worked out in my view, the current implementation certainly made more sense and was less magic.
I do agree that the magic would be bad - but the current state IS confusing, would it be possible to simply a) hide clean_data until validation has been done b) throw some exception when accessing uninitialized clean_data this would have saved me quite some time even though I knew this... its just very easy to overlook
-- ---- Waylan Limberg [EMAIL PROTECTED] >
-- Honza Kr l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---