From ff248fd4fa951f1e2cbe242aacecf21258f01b09 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 27 Jul 2017 11:21:15 +0530 Subject: [PATCH 1/5] Pass if unable to handle failed ajax response (#3797) --- frappe/public/js/frappe/request.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frappe/public/js/frappe/request.js b/frappe/public/js/frappe/request.js index b6671fea7d..40fc80ffe9 100644 --- a/frappe/public/js/frappe/request.js +++ b/frappe/public/js/frappe/request.js @@ -177,8 +177,8 @@ frappe.request.call = function(opts) { status_code_handler(data, xhr); } } catch(e) { - console.log("Unable to handle response"); - console.trace(e); + console.log("Unable to handle success response"); // eslint-disable-line + console.trace(e); // eslint-disable-line } }) @@ -201,12 +201,17 @@ frappe.request.call = function(opts) { } }) .fail(function(xhr, textStatus) { - var status_code_handler = statusCode[xhr.statusCode().status]; - if (status_code_handler) { - status_code_handler(xhr); - } else { - // if not handled by error handler! - opts.error_callback && opts.error_callback(xhr); + try { + var status_code_handler = statusCode[xhr.statusCode().status]; + if (status_code_handler) { + status_code_handler(xhr); + } else { + // if not handled by error handler! + opts.error_callback && opts.error_callback(xhr); + } + } catch(e) { + console.log("Unable to handle failed response"); // eslint-disable-line + console.trace(e); // eslint-disable-line } }); } From 22475a046c8d2da69e6f2158ed8e0f5c09072da4 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Thu, 27 Jul 2017 12:14:37 +0530 Subject: [PATCH 2/5] [hotfix] encode the email message to utf8 before sending mail (#3785) * [hotfix] encode the email message to utf8 before sending mail * [minor] review fixes --- frappe/email/queue.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/email/queue.py b/frappe/email/queue.py index e5630bc88e..e48dbb9115 100755 --- a/frappe/email/queue.py +++ b/frappe/email/queue.py @@ -474,6 +474,7 @@ def prepare_message(email, recipient, recipients_list): message = message.replace("", recipient) + message = (message and message.encode('utf8')) or '' if not email.attachments: return message From ac3e361ecf9ed31d2c96fc04e73ab13552cdc3de Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 27 Jul 2017 12:47:20 +0600 Subject: [PATCH 3/5] bumped to version 8.6.1 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 083ea3e1f3..a1a2722e4b 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '8.6.0' +__version__ = '8.6.1' __title__ = "Frappe Framework" local = Local() From a0aa9a20792203121183505819346c828ee76535 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 27 Jul 2017 17:49:01 +0530 Subject: [PATCH 4/5] [fix] callback for ajax (#3802) * [fix] callback for ajax * [fix] ajaxSend instead of ajaxStart --- frappe/public/js/frappe/request.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/frappe/public/js/frappe/request.js b/frappe/public/js/frappe/request.js index 40fc80ffe9..128ac996da 100644 --- a/frappe/public/js/frappe/request.js +++ b/frappe/public/js/frappe/request.js @@ -8,6 +8,8 @@ frappe.request.url = '/'; frappe.request.ajax_count = 0; frappe.request.waiting_for_ajax = []; + + // generic server call (call page, object) frappe.call = function(opts) { if(opts.quiet) { @@ -180,7 +182,7 @@ frappe.request.call = function(opts) { console.log("Unable to handle success response"); // eslint-disable-line console.trace(e); // eslint-disable-line } - + }) .always(function(data, textStatus, xhr) { try { @@ -218,8 +220,6 @@ frappe.request.call = function(opts) { // call execute serverside request frappe.request.prepare = function(opts) { - frappe.request.ajax_count++; - $("body").attr("data-ajax-state", "triggered"); // btn indicator @@ -258,7 +258,7 @@ frappe.request.cleanup = function(opts, r) { // un-freeze page if(opts.freeze) frappe.dom.unfreeze(); - + if(r) { // session expired? - Guest has no business here! @@ -304,14 +304,6 @@ frappe.request.cleanup = function(opts, r) { } frappe.last_response = r; - - frappe.request.ajax_count--; - if(!frappe.request.ajax_count) { - $.each(frappe.request.waiting_for_ajax || [], function(i, fn) { - fn(); - }); - frappe.request.waiting_for_ajax = []; - } } frappe.after_server_call = () => { @@ -413,3 +405,17 @@ frappe.request.cleanup_request_opts = function(request_opts) { } return request_opts; }; + +$(document).ajaxSend(function() { + frappe.request.ajax_count++; +}); + +$(document).ajaxComplete(function() { + frappe.request.ajax_count--; + if(!frappe.request.ajax_count) { + $.each(frappe.request.waiting_for_ajax || [], function(i, fn) { + fn(); + }); + frappe.request.waiting_for_ajax = []; + } +}); \ No newline at end of file From 2389f46411b4fcac681338f17f29b2851f0df77b Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 27 Jul 2017 18:29:18 +0600 Subject: [PATCH 5/5] bumped to version 8.6.2 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index a1a2722e4b..28fca585a7 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '8.6.1' +__version__ = '8.6.2' __title__ = "Frappe Framework" local = Local()