Switch to using middleware for initialization.

Review Request #2833 — Created Jan. 29, 2012 and submitted — Latest diff uploaded


Review Board


Switch to using middleware for initialization.

Our initialization code was tied into the main urls.py. The idea being
that the first request would cause URLs to be first computed, and that
would be a fine time to do our other initialization.

This changes with extensions. Initializing an extension may alter the
URLs being generated, and may actually query the actual URLs, which
won't be available just yet, breaking things on the first load.

So now initialization is done as middleware. On the first request, after
URLs have been loaded but before any views are determined, we perform
initialization, and only once.
Accessed the site with some logging and saw that initialization was
happening, and seemed to only happen once. We'll want to test this pretty
thoroughly before a release though.