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 = 'Mutual Funds Investor Monthly Report'
> rows_investor = db(db.investor.id > 0).select()
> for row_investor in rows_investor:
> query_account = (db.account.investor == row_investor.id)
> rows_account = db(query_account).select(orderby = ~db.account.id)
> mail.send(", ".join(email for email in row_investor.email), 
>  title, 
>  response.render('templates/mail/investor.html', 
>      dict(row_investor = row_investor, rows_account = rows_account) ) )
>
> *error traceback:*
> RestrictedError: <type 'exceptions.NameError'> name 'locale' is not defined
>
> solution work in views must import locale
> *e.g. in views/templates/mail/investor.html*
> {{
> import locale
> #locale.setlocale(locale.LC_ALL, 'id_ID.utf8')
> locale.setlocale(locale.LC_ALL, 'id_ID')
> }}
>
> is it normal or did i missed something? any idea or suggestion?
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to