There is a problem in that using str(widget.text()) will cause a unicode exception if the user types a unicode character.
OTOH, the keyring uses urllib.urlencode on the credentials, which means we can't pass unicode to it:
>>> urllib.urlencode({u'á':1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib.py", line 1310, in urlencode
k = quote_plus(str(k))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 0: ordinal not in range(128)
Also, it seems we are doing the same thing in other places. So, maybe this branch should land and a new bug be opened for that issue.
If that's the chosen path, feel free to land it with one review, since everything else looks ok.
There is a problem in that using str(widget.text()) will cause a unicode exception if the user types a unicode character.
OTOH, the keyring uses urllib.urlencode on the credentials, which means we can't pass unicode to it:
>>> urllib. urlencode( {u'á':1} ) python2. 7/urllib. py", line 1310, in urlencode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
k = quote_plus(str(k))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 0: ordinal not in range(128)
Also, it seems we are doing the same thing in other places. So, maybe this branch should land and a new bug be opened for that issue.
If that's the chosen path, feel free to land it with one review, since everything else looks ok.