On Tue, Apr 19, 2011 at 5:06 AM, Michael P. Soulier <msoul...@digitaltorque.ca> wrote: > I noticed that the request object is not passed to the database router, the > intention seems to mainly be to route by model. I have a case where I want to > route based on session data in the request. While I know that I can > explicitely use the using() method, this will be a tad labourious. Will it be > possible in the future to pass the request object to the database router?
Probably not -- that'd be a pretty heinous violation of separation of concerns. Remember that Django can (and often is) used outside of a web request/response cycle (think management commands, cron jobs, interactive shells, ...). The right way is indeed to use `using()` and leave session-specific handling where it belongs, in the views. [If you insist on making it automagical, you could stuff the request object in a threadlocal. That wouldn't pass *my* code review, but luckily you don't work for me :)] Jacob -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.