• 
      

    Save mail auth info as plain strings, not unicode strings.

    Review Request #1426 — Created Feb. 21, 2010 and submitted

    Information

    Djblets
    master

    Reviewers

    Save mail auth info as plain strings, not unicode strings.
    
    The HMAC library shipped with newer Python 2.6 releases doesn't work with
    Unicode strings. The library really is intended to work with bytes, and
    Python 3 apparently enforces this more heavily. We were getting the mail
    username and password as a Unicode string from the form and then saving it
    to settings as a Unicode string, which eventually made it to the HMAC library
    and failed.
    
    We now deserialize this as a plain string instead of keeping the default
    behavior of deserializing as a Unicode string. This fixes the incompatibility
    with the HMAC library.
    
    Added a unit test to check for this behavior.
    The unit test failed the HMAC test (and the type(...) == str check, but I temporarily removed that for verification) before the fix to these settings. After the fix, the unit test passed.