Replace urllib with py3kcompat.urlutils
This patch replaces urllib.* with py3kcompat.urlutils.* to make code Python 3 compatible. Part of blueprint py33 Change-Id: Iada39d9ed4003ce975611e06e79f667ff0b07704
This commit is contained in:
@@ -15,13 +15,13 @@
|
||||
|
||||
import datetime
|
||||
import re
|
||||
import urllib
|
||||
|
||||
from flask.ext import gravatar as gravatar_ext
|
||||
import six
|
||||
|
||||
from dashboard import parameters
|
||||
from dashboard import vault
|
||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
||||
from stackalytics.processor import utils
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ def format_launchpad_module_link(module):
|
||||
|
||||
|
||||
def safe_encode(s):
|
||||
return urllib.quote_plus(s.encode('utf-8'))
|
||||
return urlutils.quote_plus(s.encode('utf-8'))
|
||||
|
||||
|
||||
def make_link(title, uri=None, options=None):
|
||||
|
@@ -13,11 +13,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import urllib
|
||||
|
||||
import flask
|
||||
|
||||
from stackalytics.openstack.common import log as logging
|
||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -69,7 +68,7 @@ def get_parameter(kwargs, singular_name, plural_name=None, use_default=True):
|
||||
if (not p) and plural_name:
|
||||
p = flask.request.args.get(plural_name)
|
||||
if p:
|
||||
return urllib.unquote_plus(p).split(',')
|
||||
return urlutils.unquote_plus(p).split(',')
|
||||
elif use_default:
|
||||
default = get_default(singular_name)
|
||||
return [default] if default else []
|
||||
|
@@ -13,12 +13,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import urllib
|
||||
|
||||
from oslo.config import cfg
|
||||
import psutil
|
||||
|
||||
from stackalytics.openstack.common import log as logging
|
||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
||||
from stackalytics.processor import config
|
||||
from stackalytics.processor import default_data_processor
|
||||
from stackalytics.processor import lp
|
||||
@@ -100,7 +99,7 @@ def process_repo(repo, runtime_storage_inst, record_processor_inst):
|
||||
for branch in branches:
|
||||
LOG.debug('Processing repo %s, branch %s', uri, branch)
|
||||
|
||||
vcs_key = 'vcs:' + str(urllib.quote_plus(uri) + ':' + branch)
|
||||
vcs_key = 'vcs:' + str(urlutils.quote_plus(uri) + ':' + branch)
|
||||
last_id = runtime_storage_inst.get_by_key(vcs_key)
|
||||
|
||||
commit_iterator = vcs_inst.log(branch, last_id)
|
||||
@@ -115,7 +114,7 @@ def process_repo(repo, runtime_storage_inst, record_processor_inst):
|
||||
|
||||
LOG.debug('Processing reviews for repo %s, branch %s', uri, branch)
|
||||
|
||||
rcs_key = 'rcs:' + str(urllib.quote_plus(uri) + ':' + branch)
|
||||
rcs_key = 'rcs:' + str(urlutils.quote_plus(uri) + ':' + branch)
|
||||
last_id = runtime_storage_inst.get_by_key(rcs_key)
|
||||
|
||||
review_iterator = rcs_inst.log(branch, last_id)
|
||||
|
@@ -18,13 +18,12 @@ import datetime
|
||||
import json
|
||||
import re
|
||||
import time
|
||||
import urllib
|
||||
|
||||
|
||||
import iso8601
|
||||
import six
|
||||
|
||||
from stackalytics.openstack.common import log as logging
|
||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -69,7 +68,7 @@ def check_email_validity(email):
|
||||
|
||||
def read_uri(uri):
|
||||
try:
|
||||
fd = urllib.urlopen(uri)
|
||||
fd = urlutils.urlopen(uri)
|
||||
raw = fd.read()
|
||||
fd.close()
|
||||
return raw
|
||||
|
Reference in New Issue
Block a user