Forums

Web2py default controller no longer working

Just had an odd experience: the default() function in my Web2py controller just stopped working quite randomly mid-development. Now when I go to http://myaddress.pythonanywhere.com/controller-name/default/index, all I get is "invalid function (default/index)" displayed, where before that always invoked the default() function in the file 'default.py' in the right controller. The change I made to my code immediately before this happened was minor, and I can't make it go away by reverting the change. Changing the name of the function from default() to index() (either should work in web2py) didn't work. To further confuse things, the sample controllers in web2py seem to work fine.

Was anything global (a setting changed, or new version installed) changed this afternoon/evening in web2py? It would have been around 6:30-6:45pm Eastern time.

Huh - after much poking around and trial and error, the problem is resolved. It seems that Web2py is flakey when dealing with files that expose many controller functions. And, by default, functions are exposed if they have no arguments. This problem disappeared entirely when I added a dummy argument to each of the workhorse functions I wrote that didn't need to be exposed.