@@ -10,7 +10,6 @@ naming for same name files: file.gif, file-1.gif, file-2.gif etc | |||||
import frappe | import frappe | ||||
import json | import json | ||||
import urllib | |||||
import os | import os | ||||
import shutil | import shutil | ||||
import requests | import requests | ||||
@@ -23,6 +22,7 @@ from frappe.utils.nestedset import NestedSet | |||||
from frappe.utils import strip, get_files_path | from frappe.utils import strip, get_files_path | ||||
from PIL import Image, ImageOps | from PIL import Image, ImageOps | ||||
from six import StringIO | from six import StringIO | ||||
from six.moves.urllib.parse import unquote | |||||
import zipfile | import zipfile | ||||
class FolderNotEmpty(frappe.ValidationError): pass | class FolderNotEmpty(frappe.ValidationError): pass | ||||
@@ -383,7 +383,7 @@ def get_web_image(file_url): | |||||
extn = None | extn = None | ||||
extn = get_extension(filename, extn, r.content) | extn = get_extension(filename, extn, r.content) | ||||
filename = "/files/" + strip(urllib.unquote(filename)) | |||||
filename = "/files/" + strip(unquote(filename)) | |||||
return image, filename, extn | return image, filename, extn | ||||
@@ -5,7 +5,7 @@ from __future__ import unicode_literals | |||||
import frappe, unittest | import frappe, unittest | ||||
from frappe.email.doctype.newsletter.newsletter import confirmed_unsubscribe | 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", | emails = ["test_subscriber1@example.com", "test_subscriber2@example.com", | ||||
"test_subscriber3@example.com"] | "test_subscriber3@example.com"] | ||||
@@ -1,5 +1,5 @@ | |||||
from __future__ import print_function | from __future__ import print_function | ||||
import frappe, urllib | |||||
import frappe | |||||
import pytz | import pytz | ||||
from frappe import _ | 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.resource import ResourceEndpoint | ||||
from oauthlib.oauth2.rfc6749.endpoints.revocation import RevocationEndpoint | from oauthlib.oauth2.rfc6749.endpoints.revocation import RevocationEndpoint | ||||
from oauthlib.common import Request | from oauthlib.common import Request | ||||
from six.moves.urllib.parse import unquote | |||||
def get_url_delimiter(separator_character=" "): | def get_url_delimiter(separator_character=" "): | ||||
return separator_character | return separator_character | ||||
@@ -134,7 +135,7 @@ class OAuthWebRequestValidator(RequestValidator): | |||||
oac.scopes = get_url_delimiter().join(request.scopes) | oac.scopes = get_url_delimiter().join(request.scopes) | ||||
oac.redirect_uri_bound_to_authorization_code = request.redirect_uri | oac.redirect_uri_bound_to_authorization_code = request.redirect_uri | ||||
oac.client = client_id | 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.authorization_code = code['code'] | ||||
oac.save(ignore_permissions=True) | oac.save(ignore_permissions=True) | ||||
frappe.db.commit() | frappe.db.commit() | ||||
@@ -159,7 +160,7 @@ class OAuthWebRequestValidator(RequestValidator): | |||||
except Exception as e: | except Exception as e: | ||||
print("Failed body authentication: Application %s does not exist".format(cid=request.client_id)) | 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): | def authenticate_client_id(self, client_id, request, *args, **kwargs): | ||||
cli_id = frappe.db.get_value('OAuth Client', client_id, 'name') | cli_id = frappe.db.get_value('OAuth Client', client_id, 'name') | ||||
@@ -17,7 +17,7 @@ import frappe.defaults | |||||
import frappe.translate | import frappe.translate | ||||
from frappe.utils.change_log import get_change_log | from frappe.utils.change_log import get_change_log | ||||
import redis | import redis | ||||
from urllib import unquote | |||||
from six.moves.urllib.parse import unquote | |||||
from frappe.desk.notifications import clear_notifications | from frappe.desk.notifications import clear_notifications | ||||
from six import text_type | 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 _ | ||||
from frappe import conf | from frappe import conf | ||||
from copy import copy | from copy import copy | ||||
import urllib | |||||
from six.moves.urllib.parse import unquote | |||||
from six import text_type | from six import text_type | ||||
class MaxFileSizeReachedError(frappe.ValidationError): pass | 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://'") | # frappe.msgprint("URL must start with 'http://' or 'https://'") | ||||
# return None, None | # return None, None | ||||
file_url = urllib.unquote(file_url) | |||||
file_url = unquote(file_url) | |||||
f = frappe.get_doc({ | f = frappe.get_doc({ | ||||
"doctype": "File", | "doctype": "File", | ||||