Stanford-Online/class2go — pull request #1366 by jbau (2012-11-28 04:35:28+00:00)
Title: #1365 package to make convenience redirect use general mapping in db

@sefk

I decided that the redirect middleware _should_ actually perform the DB lookup in certain cases. (when the request is not to class.stanford.edu, class2go.stanford.edu, etc.
Justification? We incur >10 of db calls in common_page_data, so what's another one?
Also, it's hopefully the uncommon case (people are hopefully bookmarking, which will have the expanded url), and I think redirects probably are slower than db lookups.

Also updated the redirector unit tests to include some cases for db class and tutorial class.

I also updated the redirects within the path, not the domain. I.e. class.stanford.edu/db to class.stanford.edu/db/Winter2013. It uses the same CurrentTermMap table.

Note that someone will need to create the CurrentTermMap entry for db class, but future classes created via courses/new will get one entry automatically populated when the class is created.