gae-init/gae-init-babel — pull request #37 by mdxs (2014-03-18 10:54:31+00:00)
Title: Reduced get_locale overhead

As discussed in https://github.com/gae-init/gae-init-babel/pull/36, I've found that `auth/get_locale` was called 3 times on each request in `gae-init-babel`; and thus looked into the reasons why and how to improve.

Easy fix was to use a local variable in `request_started` to remove one of the three calls.

The other two calls are due to how Flask and Flask-Babel are used in the project (see https://github.com/gae-init/gae-init-babel/pull/36 for further details); and I suggest to simply keep that as-is, accepting the two subsequent calls to `get_locale`; but to make the second `@babel.localeselector`-based call more efficient by testing for that previous call result (in the same request).