We discussed this here again, and it looks like newforms currently
mixes cleaning and validating data in a not so ideal way.

Actually the clean and validation process should be separated, there
should be clean-methods and validate-methods. The process should work
in the following way, to allow full flexibility:

1) call Field.clean() - to clean the data, NOT throw any errors, just
do basic data cleaning if necessary.
2) call Form.clean_<field>() - provide _all_form_ data to this method,
so it can also clean the data depending on other form data
3) call Form.clean() - stuff that needs to be done _after_ every
single field had been cleaned

4) call Field.validate() - use the cleaned data to validate the fields
5) call Form.validate_<field>()
6) call Form.validate()

looks cleaner in my eyes. opinions please!

wolfram

On Nov 23, 2007 2:45 PM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> On Nov 23, 2007 2:41 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote:
> > > :-) yep we also discussed that here
> > > still it seems "wrong" that it needs to be done with such a hacky way 
> > > around
> > >
> >
> > I don't think that's hacky at all, really. If you want an URLField, you
> > get a field that guarantees that it really contains an URL. Otherwise it
> > should get called fields.MaybeURLField, and what would be the difference
> > between that and a plain CharField?
> >
> > You can even validate the URL in clean_url()
> >
> > But take whatever works for you...
>
> sounds right too :-). thx for the help!
> but see the other two drawbacks i wrote in the other mail
>
> wolfram
>
> >
> > --
> >
> > http://spinlock.ch/blog/
> >
> >
> > > >
> >
>
>
>
> --
> cu
>
> Wolfram
>



-- 
cu

Wolfram

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to