[web2py] Re: scheduler use python modules

2016-05-23 Thread Dave S
On Monday, May 23, 2016 at 5:05:59 PM UTC-7, 黄祥 wrote: > > Does it work to import locale in the module instead of in the view? >> > > import python module doesn't work in web2py modules, so it must redefine > again (e.g. locale, datetime) > Importing datetime in a module called by a scheduler t

[web2py] Re: scheduler use python modules

2016-05-23 Thread 黄祥
> > Does it work to import locale in the module instead of in the view? > import python module doesn't work in web2py modules, so it must redefine again (e.g. locale, datetime) > > Modules do not get the complete global environment from the model or > controller that calls them > (per reques

[web2py] Re: scheduler use python modules

2016-05-23 Thread Dave S
On Monday, May 23, 2016 at 3:01:14 PM UTC-7, 黄祥 wrote: > *my conclusion :* > - python locale module when used by scheduler must redefine it again in > views > Does it work to import locale in the module instead of in the view? Modules do not get the complete global environment from the model

[web2py] Re: scheduler use python modules

2016-05-23 Thread 黄祥
in web2py book, i think we can put template using response.render in any place in views. *ref:* http://web2py.com/books/default/chapter/29/08/emails-and-sms?search=response.render#Using-the-template-system-to-generate-messages *the evidence fact i got :* - mail() with response.render() that execu

[web2py] Re: scheduler use python modules

2016-05-23 Thread Dave S
On Saturday, May 21, 2016 at 12:08:14 PM UTC-7, Anthony wrote: > > Just to be clear, the traceback is from the view? > It looks like the error involves a* mail template* that happens to be in a subdirectory of application/views. I can't read the traceback elsethread, not knowing enough about

[web2py] Re: scheduler use python modules

2016-05-23 Thread Dave S
On Saturday, May 21, 2016 at 1:28:20 AM UTC-7, 黄祥 wrote: > > is scheduler can use python modules? > Certainly. In one of my scheduled tasks, I import os.path, datetime, sys, pysftp, and time. And this is done in a module. The "outer" procedure in the model imports datetime, the module, and c

[web2py] Re: scheduler use python modules

2016-05-21 Thread 黄祥
*full traceback got from table scheduler_run :* Traceback (most recent call last): File "/Users/MacBookPro/site/web2py/gluon/scheduler.py", line 313, in executor result = dumps(_function(*args, **vars)) File "applications/mutualfunds/models/scheduler.py", line 14, in task_mail_investor_mo

[web2py] Re: scheduler use python modules

2016-05-21 Thread Anthony
Just to be clear, the traceback is from the view? Can you show the whole traceback and the line that triggers it? On Saturday, May 21, 2016 at 4:28:20 AM UTC-4, 黄祥 wrote: > > is scheduler can use python modules? > e.g. > *models/scheduler.py* > def task_mail_investor_monthly_report(): > title = '