[fix] catch max file size

This commit is contained in:
Rushabh Mehta 2015-05-19 12:23:02 +05:30
parent 894ee9d2d8
commit af83117192
2 changed files with 5 additions and 0 deletions

View file

@ -75,6 +75,7 @@ def get_bootinfo():
def load_conf_settings(bootinfo): def load_conf_settings(bootinfo):
from frappe import conf from frappe import conf
bootinfo.max_file_size = conf.get('max_file_size') or 3145728
for key in ['developer_mode']: for key in ['developer_mode']:
if key in conf: bootinfo[key] = conf.get(key) if key in conf: bootinfo[key] = conf.get(key)

View file

@ -71,6 +71,10 @@ frappe.request.call = function(opts) {
508: function(xhr) { 508: function(xhr) {
msgprint(__("Another transaction is blocking this one. Please try again in a few seconds.")); msgprint(__("Another transaction is blocking this one. Please try again in a few seconds."));
}, },
413: function(data, xhr) {
msgprint(__("File size exceeded the maximum allowed size of {0} MB",
[(frappe.boot.max_file_size || 3145728) / 1048576]))
},
417: function(data, xhr) { 417: function(data, xhr) {
if(typeof data === "string") data = JSON.parse(data); if(typeof data === "string") data = JSON.parse(data);
opts.error_callback && opts.error_callback(data, xhr.responseText); opts.error_callback && opts.error_callback(data, xhr.responseText);