James Bennett wrote:
> Setting aside async concerns, making the request available implicitly
> would be both counter to that overall design (and I'm very much a fan
> of that design, and I suspect its simplicity and understandability is
> part of why Django's popular), and feels like an attempt to compensate
> for either poor practice on the part of developers, or a
> misunderstanding of what it means to be easy to use (I occasionally
> see people complain that explicitly taking the request as an argument
> in views, on grounds of DRY, and then wonder why those people choose
> to use a language that requires explicit 'self' in methods...).

Your point about 'self' made me think. When I first got in touch with
Python I was like "wtf" when seing the explicit passing of the object
reference. I disliked it for quite some time until I came to realize how
easy and understandable currying, bound methods and dynamic class
definition suddenly became. No more magic this pointer hanging around,
but some explicit self reference. These days I love it and I would bury
my own ideals of beautiful code if I'd continue defending the request
object being put in a thread local.

So in the end I have to agree with you and Alex that the request object
registered inside a threading.local object is a bad idea. Not bad as in
awful, but a "don't do unless the customer is bugging you to get some
'simple feature' done which requires a massive rewrite because the
request object is not around".

I'm still not fully convinced that thread local objects are evil in
generally, as I've been bitten by the reality way too often and needed
them to get stuff done. However, your point makes perfect sense to me
and I have to agree that it probably shouldn't be part of the Django core.


--mp

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