Add a LocalDataQuerySet for using generic data in WebAPIResource.

This introduces LocalDataQuerySet, which operates similarly to a
QuerySet, but can store any iterable data. The interface it exposes is
similar enough to QuerySet for basic usage.

While this may be useful for various purposes, it's largely intended for
use with WebAPIResource. Before now, getting WebAPIResource to return
data not from a database was tricky. You had to rewrite the
serialization functions, get(), get_list(), etc. Now, get_queryset() can
return a LocalDataQuerySet, passing in whatever it needs, and
WebAPIResource will work with it.

Reviewed at https://reviews.reviewboard.org/r/5880/
Add support for custom paginated responses in API resources.

WebAPIResource now allows subclasses to set `paginated_cls` to a
subclass of a WebAPIResponsePaginated. This will be used for handling
the pagination of the resource's queryset and for serializing the data.

WebAPIResponsePaginated has been fully restructured to make its behavior
customizable. Subclasses can override nearly every aspect of it,
including previous/next calculation, URL building, results fetching,
link building, etc. This makes it possible to do such things as paginate
by SHA1, or by page (instead of result item index), or fetch data from
something other than a database-backed queryset.

Reviewed at https://reviews.reviewboard.org/r/5895/
Split djblets.webapi.core into smaller modules.

Over time, djblets.webapi.core has grown, and contained classes better
suited for other modules. We even had a circular dependency due to the
way that things were split up.

This splits out all the encoder-related classes and registration logic
into the existing encoders.py, and all the response classes into
responses.py.

The existing djblets.webapi.core will emit a DeprecationWarning, but
will continue to work as before.

No logic has changed, with the exception of changing old-style
`MyParent.function(self, ...)` calls to use `super()` instead.

Reviewed at https://reviews.reviewboard.org/r/5899/
Speed up unit tests for projects that use extensions.

Projects supporting extensions that used the test HTTP client would end
up reloading all extensions, creating RegisteredExtension entries, every
time a request was performed. This added up quite a bit over time.

This change does two things to address this problem.

1. The RegisteredExtension creation code has been improved. Instead of
   using get_or_create, we attempt a create and fall back on a get. This
   chops the number of queries in half, since we no longer are assuming
   there's an entry in the database already (which is a bad assumption,
   since earlier in the function, we checked and didn't see any).

   While here, I also fixed a bug where the wrong value was being
   used for the stored extension name, due to a scoping issue.

2. ExtensionsMiddleware no longer performs expiration checks if
   settings.RUNNING_TEST is True. It's up to the projects to set this
   for the test run, though.

Reviewed at https://reviews.reviewboard.org/r/5905/
Cache object lookups in WebAPIResource.get_object.

It's pretty common for different parts of a WebAPIResource subclass to
perform a get_object() call either on itself or on another resource.
This will happen in get_queryset() and in the permission-checking
functions. These checks are time-consuming and result in excess
database queries.

The built-in get_object() now supports caching of these objects. The
caches are tied to the request, so any redundant get_object() calls
taking place within that request will just use the original call's
result.

Reviewed at https://reviews.reviewboard.org/r/5906/
Merge branch 'release-0.8.x'