Scheduler - response.render no longer working

59 views
Skip to first unread message

Brian M

unread,
Oct 2, 2016, 11:15:18 PM10/2/16
to web2py-users
OK, so I've had multiple scheduled tasks running for years that use response.render('path/to/template.html', dict(var= 'something')) to help build email bodies and it has been working perfectly. Now when I try to upgrade to the latest web2py trunk (was on 2.13.4 - yeah I'm a bit behind) all that has stopped working.  Below is the error I'm getting
File "C:\FMSC Webapps\web2py_master\gluon\globals.py", line 437, in render
   
self._view_environment.update(self._vars)
AttributeError: 'NoneType' object has no attribute 'update'

Why isn't this working anymore? Has some backwards compatibility breaking change been made to the scheduler environment? Any advice would be much appreciated.

-Brian

PS. I've seen https://groups.google.com/forum/#!searchin/web2py/response.render$20scheduler|sort:relevance/web2py/UsUvODL07zs/HrcCsxQcCQAJ which would seem related but I'm unable to get it working by just adding from gluon.template import render

Niphlod

unread,
Oct 3, 2016, 5:48:40 AM10/3/16
to web2py-users, paolo....@gmail.com, Massimo Di Pierro
hum. Trunk has been recently updated in the management of caching code for controllers and views .... wonder if this is related to that.

Anthony

unread,
Oct 3, 2016, 12:17:15 PM10/3/16
to web2py-users, paolo....@gmail.com, massimo....@gmail.com
Actually, we broke it here: https://github.com/web2py/web2py/commit/b4acfd0724845633f667a55e593a15576379554d.

Previously, response._view_environment was created at the end of build_environment, and then again very shortly thereafter in serve_controller (right after executing the models). We thought we could get rid of the line in build_environment, but it turns out that creates a problem for the scheduler (and presumably the shell), as the application code is executed via shell.env rather than serve_controller in those cases.

I'll open an issue and propose a fix.

Anthony

Anthony

unread,
Oct 3, 2016, 12:29:52 PM10/3/16
to web2py-users, paolo....@gmail.com, massimo....@gmail.com

Brian M

unread,
Oct 9, 2016, 8:23:07 PM10/9/16
to web2py-users
Seems to be working now. Thanks Anthony
Reply all
Reply to author
Forward
0 new messages