Remove Local Site code from Djblets WebAPITokens and sanitize arguments.

Review Request #8172 — Created May 17, 2016 and submitted — Latest diff uploaded

Information

Djblets
release-0.9.x
e32ca29...

Reviewers

The WebAPIToken code used to live in Review Board, and was moved to
Djblets. When that happened, the local_site argument to the function was
kept, unintentionally. We still need it, though, and callers will need
to be able to set their own custom token model fields when generating a
token, so generate_token() now accepts keyword arguments, passing them
along to the model.

Calling this function could still be a bit confusing, though, as some
arguments seemed optional but would trigger strange errors when saving
the token. These were due to the fields not working with None values. We
now set sane types and normalize values when saving, helping with the
default case of not passing all arguments.

Djblets and Review Board unit tests pass.

Tested manually with a new unit test in Review Board I had worked on,
which hit the issues with the default values for optional parameters.