Add ability to use email in Gitlab authentication

Older versions of Gitlab API v3 only allow authentication using email instead
of "login" parameter that Review board currently uses.

See https://github.com/gitlabhq/gitlabhq/commit/559e83d30004e0c41a30f4ce3463f695eb7e26a1

Testing Done:
Unit tests pass. Tested authentication with email againts different versions of
Gitlab.

Reviewed at https://reviews.reviewboard.org/r/5591/
The cache setting has been moved into a dictionary variable in django 1.3.

This change updates settings_local.py.tmpl to use CACHES instead of
CACHE_BACKEND.

Reviewed at https://reviews.reviewboard.org/r/5651/
Fix a typo.

s/parames/params/. Trivial fix.
Properly handle text attachment encodings for thumbnail generation.

Uploading a utf-16le encoded text file as an attachment would cause a
traceback, since it can't be coerced to unicode using the default encoding.
Since we have the mimetype, we can pull the encoding out of that, and decode
properly.

Testing done: Ran unit tests and tested uploading file through the web UI.

Fixes bug 3282.

Reviewed at https://reviews.reviewboard.org/r/5630/