Remove Local Site code from Djblets WebAPITokens and sanitize arguments.
Review Request #8172 — Created May 17, 2016 and submitted
The
WebAPIToken
code used to live in Review Board, and was moved to
Djblets. When that happened, thelocal_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, sogenerate_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 withNone
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.
- Change Summary:
-
Added "Raises" and "Returns" sections.
Left the mention of the exception in the body of the docs, to help provide a high-level summary of the behavior.
- Commit:
-
e32ca29a2db5e6904f7a34b5a013f85034a7cec7