Skip to content

Commit

Permalink
Replace from six.moves.urllib.parse import unquote.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Sep 19, 2019
1 parent 38b68ed commit e0e2994
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/App/Management.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

import html
import itertools
import urllib.parse

import six
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote

import zope.event
from AccessControl import ClassSecurityInfo
Expand Down Expand Up @@ -103,11 +103,11 @@ def tabs_path_default(self, REQUEST):
for step in steps:
script = '%s/%s' % (script, step)
yield {'url': linkpat.format(html.escape(script, True)),
'title': html.escape(unquote(step)),
'title': html.escape(urllib.parse.unquote(step)),
'last': False}
script = '%s/%s' % (script, last)
yield {'url': linkpat.format(html.escape(script, True)),
'title': html.escape(unquote(last)),
'title': html.escape(urllib.parse.unquote(last)),
'last': True}

def tabs_path_info(self, script, path):
Expand Down
4 changes: 2 additions & 2 deletions src/OFS/CopySupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import logging
import re
import tempfile
import urllib.parse
import warnings
from json import dumps
from json import loads
Expand All @@ -24,7 +25,6 @@

import six
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote

import transaction
from AccessControl import ClassSecurityInfo
Expand Down Expand Up @@ -683,7 +683,7 @@ def _cb_decode(s, maxsize=8192):
Return a list of text IDs.
"""
dec = decompressobj()
squashed = unquote(s).encode('latin-1')
squashed = urllib.parse.unquote(s).encode('latin-1')
data = dec.decompress(squashed, maxsize)
if dec.unconsumed_tail:
raise ValueError
Expand Down
7 changes: 4 additions & 3 deletions src/OFS/absoluteurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#
##############################################################################

import urllib.parse

from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote

from Acquisition import aq_parent
from OFS.interfaces import ITraversable
Expand All @@ -36,7 +37,7 @@ class AbsoluteURL(BrowserView):
"""

def __unicode__(self):
return unquote(self.__str__()).decode('utf-8')
return urllib.parse.unquote(self.__str__()).decode('utf-8')

def __str__(self):
context = self.context
Expand Down Expand Up @@ -94,7 +95,7 @@ class OFSTraversableAbsoluteURL(BrowserView):
"""

def __unicode__(self):
return unquote(self.__str__()).decode('utf-8')
return urllib.parse.unquote(self.__str__()).decode('utf-8')

def __str__(self):
return self.context.absolute_url()
Expand Down
5 changes: 2 additions & 3 deletions src/Products/Five/browser/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"""

import os

from six.moves.urllib.parse import unquote
import urllib.parse

import zope.browserresource.directory
import zope.browserresource.file
Expand Down Expand Up @@ -48,7 +47,7 @@ def __call__(self):
name = self.__name__
container = self.__parent__

url = unquote(absoluteURL(container, self.request))
url = urllib.parse.unquote(absoluteURL(container, self.request))
if not isinstance(container, DirectoryResource):
name = '++resource++%s' % name
return "%s/%s" % (url, name)
Expand Down
4 changes: 2 additions & 2 deletions src/Testing/ZopeTestCase/zopedoctest/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def http(request_string, handle_errors=True):
This is used for HTTP doc tests.
"""
from six.moves.urllib.parse import unquote
import urllib.parse
from ZPublisher.HTTPRequest import WSGIRequest as Request
from ZPublisher.HTTPResponse import WSGIResponse
from ZPublisher.WSGIPublisher import publish_module
Expand All @@ -149,7 +149,7 @@ def http(request_string, handle_errors=True):
command_line = request_string[:newline].rstrip()
request_string = request_string[newline + 1:]
method, path, protocol = command_line.split()
path = unquote(path)
path = urllib.parse.unquote(path)

env = {
'HTTP_HOST': 'localhost',
Expand Down
6 changes: 3 additions & 3 deletions src/ZPublisher/HTTPRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import random
import re
import time
import urllib.parse
from cgi import FieldStorage
from copy import deepcopy

from six import binary_type
from six import string_types
from six import text_type
from six.moves.urllib.parse import unquote
from six.moves.urllib.parse import urlparse

from AccessControl.tainted import should_be_tainted
Expand Down Expand Up @@ -270,7 +270,7 @@ def physicalPathFromURL(self, URL):
else:
raise ValueError('Url does not match virtual hosting context')
vrpp = other.get('VirtualRootPhysicalPath', ('',))
return list(vrpp) + list(map(unquote, path))
return list(vrpp) + list(map(urllib.parse.unquote, path))

def _resetURLS(self):
other = self.other
Expand Down Expand Up @@ -1741,7 +1741,7 @@ def parse_cookie(text,
return result

if name not in result:
result[name] = unquote(value)
result[name] = urllib.parse.unquote(value)

return parse_cookie(text[c_len:], result)

Expand Down
4 changes: 2 additions & 2 deletions src/ZTUtils/Zope.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"""

import html
import urllib.parse

from six import binary_type
from six import text_type
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote

from AccessControl import getSecurityManager
from AccessControl.unauthorized import Unauthorized
Expand Down Expand Up @@ -340,7 +340,7 @@ def url_query(request, req_name="URL", omit=None):
omits[name] = None

for i in range(len(qsparts)):
name = unquote(qsparts[i].split('=', 1)[0])
name = urllib.parse.unquote(qsparts[i].split('=', 1)[0])
if name in omits:
qsparts[i] = ''
name = name.split(':', 1)[0]
Expand Down

0 comments on commit e0e2994

Please sign in to comment.