coto / gae-boilerplate

Google App Engine Boilerplate
https://dev-dot-sandengine.appspot.com/
Other
685 stars 189 forks source link

'uri_for' is not globally defined #279

Closed jeffmpotter closed 10 years ago

jeffmpotter commented 10 years ago

'uri_for' is only defined in the basehandler.py and causes 500 'uri_for' undefined errors in certain circumstances.

Steps to reproduce:

  1. Stop all running instances in your GAE dashboard.
  2. Browse to an invalid page for your app (e.g. www.myapp.com/this-page-does-not-exist).
  3. In GAE logs verify a 404 error for the request to 'this-page-does-not-exist' is sent as expected. Logs also show that this request "caused a new process to be started" as expected.
  4. Now go to a valid page for your app (e.g. www.myapp.com). This will send the 500 'uri_for' undefined error.

When this happens the instance will never properly work (always gives uri_for errors for every valid uri). You have to manually stop the running instance and hope that the first request is always a valid page.

rlarge commented 10 years ago

I have to agree with this, but as it is not a problem unless your first request has an error..

rlarge commented 10 years ago

And there is a error with git hub that doesn't update the page when you post a comment..... i just posted 5 not knowing it saved...lol

Bezoar commented 10 years ago

This is happening because error_handler (bp_includes/lib) is not initializing Jinja with the factory function provided by basehandler (called jinja2_factory). I split out generate_csrf_token and jinja2_factory from basehandler into a separate module, included it in both basehandler and error_handler, and that fixes the abovementioned behavior on our site.

I just sent a pull request with this change.

coto commented 10 years ago

Closed with #291