• 
      

    Remove Local Site code from Djblets WebAPITokens and sanitize arguments.

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

    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.

    Description From Last Updated

    Want to change this to "Raises"?

    daviddavid

    Returns?

    daviddavid
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          djblets/webapi/tests/test_api_token.py
          djblets/webapi/managers.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          djblets/webapi/tests/test_api_token.py
          djblets/webapi/managers.py
      
      
    2. 
        
    david
    1. 
        
    2. djblets/webapi/managers.py (Diff revision 1)
       
       
       
       
      Show all issues

      Want to change this to "Raises"?

    3. djblets/webapi/managers.py (Diff revision 1)
       
       
      Show all issues

      Returns?

    4. 
        
    chipx86
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          djblets/webapi/tests/test_api_token.py
          djblets/webapi/managers.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          djblets/webapi/tests/test_api_token.py
          djblets/webapi/managers.py
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.9.x (3297c2c)