User: Fix GPG auth on Python 3. Closes GH-541. Closes GH-542.

This commit is contained in:
Valentin Lorentz 2014-01-17 19:15:28 +00:00
parent 1f2d51dfc5
commit b7bfd64bc4

View File

@ -490,7 +490,10 @@ class User(callbacks.Plugin):
Check the GPG signature at the <url> and authenticates you if
the key used is associated to a user."""
self._expire_tokens()
match = self._auth_re.search(utils.web.getUrl(url))
content = utils.web.getUrl(url)
if sys.version_info[0] >= 3 and isinstance(content, bytes):
content = content.decode()
match = self._auth_re.search(content)
if not match:
irc.error(_('Signature or token not found.'), Raise=True)
data = match.group(0)