fix variable name
PEP8 and some errors fixes
fix pep8 and pyflake issues
Fix compatibility with Python < 2.7

My change for handling alternate casing in svn:keywords only worked with Python
2.7 (prior versions don't have a `flags` argument to `re.sub()`).

This change makes it so we compile the regex first using re.IGNORECASE, and
then call the substitution method on the regex object.

Testing done: Ran tests under python 2.6

Reviewed at https://reviews.reviewboard.org/r/6207/
Merge branch 'release-1.7.x' into release-2.0.x
Merge branch 'release-2.0.x'
Fix usage of _api_get in GitLab.

A change to the GitLab implementation to add support for more than 100 repos
ended up breaking things, because it changed the return signature of _api_get
without fixing up all the call sites. With the addition of the headers, we now
need to extract the first part of the tuple instead of just using the return
value directly.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/6210/
Fix original-file and patched-file tests.

Some of the tests for the original-file and patched-file resources were failing
because it was trying to decode the responses as JSON. The problem was that one
of the GET test implementations was updated for the new
`basic_get_returns_json` field but not another. I've made an equivalent change
to handle it.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/6211/
Fix account page tests.

The addition of the API tokens page for the user account preferences caused
some test breakages. I've fixed them, and also centralized the code a bit so
there are fewer changes to make when we change the structure of the pages.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/6211/
Fix API token unit tests.

Several API tests were failing because the proposed token policies were missing
a "resources" field. I've added this to the tests, and refactored the common
data out so that if we want to make any changes to the policy string, it's only
in one place.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/6213/
Change file attachment upload to use a backbone view.

This change adds a new backbone view for file uploads (the one that you see
when you click Update -> Add File). That popup was previously done via
$.formDlg and the old "datastore" code. Now it's a standalone view.
This will also be used for the future attachment updating feature.

Testing Done:
* Uploading new attachments.
* Error when no attachment is specified.
* Multiple errors returned from server side (see screenshots).

Reviewed at https://reviews.reviewboard.org/r/5911/
Clean up formDlg and gReviewRequest code.

Now that both the "Update Diff" and "Upload File" dialogs are handled via new
javascript code, we can get rid of a lot of legacy stuff. This change removes
review_request_dlgs.html, $.formDlg, and gReviewRequest.

Testing done: Ran javascript tests.
Don't cache commits as aggressively if 'branch' and 'start' aren't provided.

The code for getting the list of commits would cache for one day, but we only
want to do that if the branch and start commit are explicitly specified. If
not, we should still cache but for a much shorter period (to avoid the list
being up to one day out of date). This change fixes that.

Testing done:
- Tested svn post-commit list.
- Ran unit tests.

Fixes bug 3511.

Reviewed at https://reviews.reviewboard.org/r/6201/
Merge branch 'release-2.0.x'
Merge branch 'master' of https://github.com/reviewboard/reviewboard into HEAD
Merge branch 'diff_encoding'