Switch all urllib/urlparse usage to six.moves.urllib.

This provides Python 2+3 compatibility for our use of urllib.

Also add a test to avoid future regressions.
This commit is contained in:
Tim Abbott
2016-01-23 18:39:44 -08:00
parent 52f9574047
commit 6528b18ad3
15 changed files with 58 additions and 55 deletions

View File

@@ -13,7 +13,7 @@ import datetime
import re
import subprocess
import ujson
import urllib
from six.moves import urllib
from collections import defaultdict
def unsubscribe_token(user_profile):
@@ -35,7 +35,7 @@ def hashchange_encode(string):
# Do the same encoding operation as hashchange.encodeHashComponent on the
# frontend.
# `safe` has a default value of "/", but we want those encoded, too.
return urllib.quote(
return urllib.parse.quote(
string.encode("utf-8"), safe="").replace(".", "%2E").replace("%", ".")
def pm_narrow_url(participants):