Added sandboxing to action_hooks

This change adds sandboxing to the various action hooks (which allow users to
insert buttons or menu items into various pieces of the UI), so that broken
extensions won't break everything.

Testing Done:
Unit testing done - tested all 5 different action hooks (DiffViewerActionHook,
HeaderActionHook, HeaderDropdownActionHook, ReivewRequestActionHook,
ReviewRequestDropdownActionHook) with and without the sandboxing. Ran on all
tests in extensions/tests.py

Reviewed at https://reviews.reviewboard.org/r/5710/
Merge branch 'release-2.0.x'
Fix upgrading from pre-1.7 databases.

rb-site does a check to see if a dedup operation should be run. This
ends up checking some modern fields that didn't exist pre-1.7.

We now wrap this and catch the exception, handling the case where the
operation fails due to a database error. The assumption we make is that
if there's a database error, we're likely upgrading from a database that
doesn't have these columns, and a dedup is probably needed.

Reviewed at https://reviews.reviewboard.org/r/5756/
Prevent caching of filediffs when condensing diffs.

Some users reported running out of memory when attempting to condense
diffs on large databases. This is caused by Django's default behavior
of caching retrieved objects when evaluating a queryset. It'd end up
caching all objects it'd fetch, eating up all memory.

Using iterator() bypasses this, preventing caching and giving us the
objects directly. It should prevent the memory issues people were
hitting.
Merge branch 'release-2.0.x'