Replaced urllib.unquote imports with six.moves.urllib.parse.unquote (#3836)
This commit is contained in:
parent
9d7d384a63
commit
16a9bdfd31
5 changed files with 10 additions and 9 deletions
|
|
@ -10,7 +10,6 @@ naming for same name files: file.gif, file-1.gif, file-2.gif etc
|
|||
|
||||
import frappe
|
||||
import json
|
||||
import urllib
|
||||
import os
|
||||
import shutil
|
||||
import requests
|
||||
|
|
@ -23,6 +22,7 @@ from frappe.utils.nestedset import NestedSet
|
|||
from frappe.utils import strip, get_files_path
|
||||
from PIL import Image, ImageOps
|
||||
from six import StringIO
|
||||
from six.moves.urllib.parse import unquote
|
||||
import zipfile
|
||||
|
||||
class FolderNotEmpty(frappe.ValidationError): pass
|
||||
|
|
@ -383,7 +383,7 @@ def get_web_image(file_url):
|
|||
extn = None
|
||||
|
||||
extn = get_extension(filename, extn, r.content)
|
||||
filename = "/files/" + strip(urllib.unquote(filename))
|
||||
filename = "/files/" + strip(unquote(filename))
|
||||
|
||||
return image, filename, extn
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||
import frappe, unittest
|
||||
|
||||
from frappe.email.doctype.newsletter.newsletter import confirmed_unsubscribe
|
||||
from urllib import unquote
|
||||
from six.moves.urllib.parse import unquote
|
||||
|
||||
emails = ["test_subscriber1@example.com", "test_subscriber2@example.com",
|
||||
"test_subscriber3@example.com"]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from __future__ import print_function
|
||||
import frappe, urllib
|
||||
import frappe
|
||||
import pytz
|
||||
|
||||
from frappe import _
|
||||
|
|
@ -12,6 +12,7 @@ from oauthlib.oauth2.rfc6749.endpoints.token import TokenEndpoint
|
|||
from oauthlib.oauth2.rfc6749.endpoints.resource import ResourceEndpoint
|
||||
from oauthlib.oauth2.rfc6749.endpoints.revocation import RevocationEndpoint
|
||||
from oauthlib.common import Request
|
||||
from six.moves.urllib.parse import unquote
|
||||
|
||||
def get_url_delimiter(separator_character=" "):
|
||||
return separator_character
|
||||
|
|
@ -134,7 +135,7 @@ class OAuthWebRequestValidator(RequestValidator):
|
|||
oac.scopes = get_url_delimiter().join(request.scopes)
|
||||
oac.redirect_uri_bound_to_authorization_code = request.redirect_uri
|
||||
oac.client = client_id
|
||||
oac.user = urllib.unquote(cookie_dict['user_id'])
|
||||
oac.user = unquote(cookie_dict['user_id'])
|
||||
oac.authorization_code = code['code']
|
||||
oac.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
|
|
@ -159,7 +160,7 @@ class OAuthWebRequestValidator(RequestValidator):
|
|||
except Exception as e:
|
||||
print("Failed body authentication: Application %s does not exist".format(cid=request.client_id))
|
||||
|
||||
return frappe.session.user == urllib.unquote(cookie_dict.get('user_id', "Guest"))
|
||||
return frappe.session.user == unquote(cookie_dict.get('user_id', "Guest"))
|
||||
|
||||
def authenticate_client_id(self, client_id, request, *args, **kwargs):
|
||||
cli_id = frappe.db.get_value('OAuth Client', client_id, 'name')
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import frappe.defaults
|
|||
import frappe.translate
|
||||
from frappe.utils.change_log import get_change_log
|
||||
import redis
|
||||
from urllib import unquote
|
||||
from six.moves.urllib.parse import unquote
|
||||
from frappe.desk.notifications import clear_notifications
|
||||
from six import text_type
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from frappe.utils import get_hook_method, get_files_path, random_string, encode,
|
|||
from frappe import _
|
||||
from frappe import conf
|
||||
from copy import copy
|
||||
import urllib
|
||||
from six.moves.urllib.parse import unquote
|
||||
from six import text_type
|
||||
|
||||
class MaxFileSizeReachedError(frappe.ValidationError): pass
|
||||
|
|
@ -67,7 +67,7 @@ def save_url(file_url, filename, dt, dn, folder, is_private):
|
|||
# frappe.msgprint("URL must start with 'http://' or 'https://'")
|
||||
# return None, None
|
||||
|
||||
file_url = urllib.unquote(file_url)
|
||||
file_url = unquote(file_url)
|
||||
|
||||
f = frappe.get_doc({
|
||||
"doctype": "File",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue