Note that I made this comment in reaction to Alexey’s email here :-)

-- 
Aymeric.

> On 26 Sep 2016, at 14:34, charettes <charett...@gmail.com> wrote:
> 
> Hi Alexey,
> 
> I'm not sure I understand why the approach Aymeric suggested is not viable for
> your use case.
> 
> It can be implemented in a few lines and doesn't require any modification to
> Django core.
> 
> 
> class ShortCircuitValidator(object):
>     def __init__(self, *validators):
>         self.validators = validators
> 
>     def __call__(self, value):
>         for validator in self.validators:
>             validator(value)
> 
> 
> class FileForm(forms.Form):
>     file = forms.FileField(
>         validators=[ShortCircuitValidator(
>             FileSizeValidator(max_size='500 kb'),
>             FileTypeValidator(extensions=['xlsx']),
>         )],
>     )
> 
> Simon
> 
> Le lundi 26 septembre 2016 07:05:36 UTC-4, Alexey Rogachev a écrit :
> I opened ticket https://code.djangoproject.com/ticket/27263 
> <https://code.djangoproject.com/ticket/27263>.
> 
> Do you think the solution I suggested in comment is OK?
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com 
> <mailto:django-developers+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-developers@googlegroups.com 
> <mailto:django-developers@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-developers 
> <https://groups.google.com/group/django-developers>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/5895bcc4-1289-4adf-80a3-f595806d49a7%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-developers/5895bcc4-1289-4adf-80a3-f595806d49a7%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/59EAADD5-6343-4A78-BB4C-C5CB4254823F%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to