Hi all!

I like patch 2 [1] for ticket #6362. It has docs and tests, but Yuri propose
more interesting way.
+1 for somthing like SomeField(validators=[...], processors=[...]) where
`processors` is used for normalize value to common format, and `validators`
is used for validate this value.

[1] https://code.djangoproject.com/attachment/ticket/6362/6362.diff


Cheers!

On Tue, Jul 12, 2011 at 6:22 PM, Dmitry Gladkov <dmitry.glad...@gmail.com>wrote:

> Hi Yuri,
>
> At first I thought that we should extend validators logic, but then I
> realized that validation and cleaning (agree that 'cleaners' is a
> better term than 'processors') are rather different tasks and mixing
> them could be ambiguous, not mentioning backwards incompatibile as a
> cleaner should return a value whether a validator should not.
>
>
> --
> Best wishes,
> Dmitry Gladkov, mailto:dmitry.glad...@gmail.com
>
> +380 91 303-37-46
>
>
>
> On Tue, Jul 12, 2011 at 2:09 PM, burc...@gmail.com <burc...@gmail.com>
> wrote:
> > Hi Dmitry,
> > I think we could have combination of "validators" + "processors":
> > they will return either exception or cleaned value.
> > For example,
> > SomeField(cleaners=[clean_and_validate_email()])
> > Did you mean exactly this or rather separated SomeField(validators=[...],
> > processors=[...]) ?
> > On Mon, Jul 11, 2011 at 6:31 PM, Dmitry Gladkov <
> dmitry.glad...@gmail.com>
> > wrote:
> >>
> >> I don't see what's wrong with 'strip' attribute for models.Field,
> >> we've already non database-related 'blank' attribute, but I agree that
> >> it does not solve the general problem.
> >>
> >> What I'm thinking about is something like django.core.validators [1],
> >> but called 'processors' with the only and main difference that
> >> processor returns value which gets passed to the next processor in
> >> chain.
> >>
> >> I'm not sure that it plays nice with existing clean_[fieldname]
> >> methods and that 'processor' is a good name either, but I'd like to
> >> hear what do you think about this idea.
> >>
> >> Thanks.
> >>
> >>
> >> [1]
> >>
> https://docs.djangoproject.com/en/dev/ref/forms/validation/#using-validators
> >>
> >>
> >> --
> >> Best wishes,
> >> Dmitry Gladkov, mailto:dmitry.glad...@gmail.com
> >>
> >> +380 91 303-37-46
> >>
> >>
> >>
> >> On Mon, Jul 11, 2011 at 12:26 AM, Chris Beaven <smileych...@gmail.com>
> >> wrote:
> >> > To clarify, didn't even notice we were talking about models.Field, I'm
> >> > +0
> >> > for a 'strip' attribute on the form's field, nothing on the model.
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Django developers" group.
> >> > To view this discussion on the web visit
> >> > https://groups.google.com/d/msg/django-developers/-/r9DLUCsK6rUJ.
> >> > To post to this group, send email to
> django-developers@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-developers+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/django-developers?hl=en.
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django developers" group.
> >> To post to this group, send email to django-developers@googlegroups.com
> .
> >> To unsubscribe from this group, send email to
> >> django-developers+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-developers?hl=en.
> >>
> >
> >
> >
> > --
> > Best regards, Yuri V. Baburov, Skype: yuri.baburov, MSN: bu...@live.com
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django developers" group.
> > To post to this group, send email to django-developers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-developers+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-developers?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>


-- 
Alex Kamedov
skype: kamedov    www: kamedov.ru

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

Reply via email to