> On Jan 8, 2016, at 11:57 AM, Ryan Hiebert <r...@ryanhiebert.com> wrote:
> 
>> On Jan 8, 2016, at 11:35 AM, Aymeric Augustin 
>> <aymeric.augus...@polytechnique.org> wrote:
>> 
>> In the spirit of “there should be only one way to do it”, I would require 
>> raising MiddlewareNotUsed explicitly to disable a middleware.
> 
> I definitely agree with this critique. I regularly forget to return the 
> wrapper function when writing decorators, and this seems likely to have the 
> same issue. Having it warn me early and loud that I screwed up would be very 
> helpful.

And perhaps instead of raising, it could just return MiddlewareNotUsed, in a 
similar way as you would return NotImplemented on implementations of dunder 
methods. This case doesn't require doing things that way, as there's no 
equivalent to the right-side fallback of operators, but I think it may still be 
an option worth considering.

-- 
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/4024A245-7A77-4F4E-905D-3712308BCC7B%40ryanhiebert.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to