edx/edx-platform — pull request #1357 by jbau (2013-10-16 00:42:55+00:00)
Title: Jbau/shoppingcart user middleware

@dianakhuang @adampalay

I think this is a better way to fix https://edx-wiki.atlassian.net/browse/LMS-1222 than https://github.com/edx/edx-platform/pull/1345 . It removes database accesses from template rendering, and so removes any landmines with database transactions. In the spirit of having completely "mindless" templates, this moves the database access out of the `navigation.html` template into middleware.

If there were a good views file to put the logic for figuring out when to display the icon, that's where I would have put it. But `navigation.html` is basically "called" by being included by `main.html`, so there are many view functions that render it. Hence the need for middleware.

FYI: @symbolist