Merge branch 'master' of github.com:webnotes/wnframework

This commit is contained in:
Nabin Hait 2011-08-29 14:35:42 +05:30
commit cdd4f3b4f0
3 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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)}