diff --git a/cgi-bin/webnotes/utils/__init__.py b/cgi-bin/webnotes/utils/__init__.py index 1376ed7d41..6e342f1802 100644 --- a/cgi-bin/webnotes/utils/__init__.py +++ b/cgi-bin/webnotes/utils/__init__.py @@ -119,7 +119,7 @@ def getdate(string_date): else: return '' -def add_days(date, days): +def add_days(date, days, format='string'): """ Adds `days` to the given `string_date` """ @@ -130,7 +130,11 @@ def add_days(date, days): if type(date) not in (datetime.datetime, datetime.date): date = getdate(date) - return (date + datetime.timedelta(days)).strftime('%Y-%m-%d') + dt = date + datetime.timedelta(days) + if format=='string': + return dt.strftime('%Y-%m-%d') + else: + return dt def add_months(string_date, months): import datetime diff --git a/js/webpage/page.js b/js/webpage/page.js index 9a54138b01..836bc74aac 100644 --- a/js/webpage/page.js +++ b/js/webpage/page.js @@ -56,7 +56,7 @@ function render_page(page_name, menuitem) { p.doc = pdoc; if(script) { - try { eval(script); } catch(e) { submit_error(e); } + eval(script); } // change diff --git a/js/wnf.compressed.js b/js/wnf.compressed.js index 2848ab2bd2..86fc63b145 100644 --- a/js/wnf.compressed.js +++ b/js/wnf.compressed.js @@ -1130,7 +1130,7 @@ pages['_home']=this;return this;} function render_page(page_name,menuitem){if(!page_name)return;if((!locals['Page'])||(!locals['Page'][page_name])){loadpage('_home');return;} var pdoc=locals['Page'][page_name];if(pdoc.style)set_style(pdoc.style) if(pdoc.stylesheet){set_style(locals.Stylesheet[pdoc.stylesheet].stylesheet);stylesheets.push(pdoc.stylesheet);} -var p=new Page(page_name,pdoc._Page__content?pdoc._Page__content:pdoc.content);var script=pdoc.__script?pdoc.__script:pdoc.script;p.doc=pdoc;if(script){try{eval(script);}catch(e){submit_error(e);}} +var p=new Page(page_name,pdoc._Page__content?pdoc._Page__content:pdoc.content);var script=pdoc.__script?pdoc.__script:pdoc.script;p.doc=pdoc;if(script){eval(script);} page_body.change_to(page_name);try{if(pscript['onload_'+page_name])pscript['onload_'+page_name]();}catch(e){submit_error(e);} return p;} function refresh_page(page_name){var fn=function(r,rt){render_page(page_name)}