moraes/webapp-improved — pull request #7 by cklein (2012-02-06 16:28:20+00:00)
Title: Bugfix for unitialized attribute `app`

Under some strange(?) circumstances, self.app is None which leads to a RuntimeError:

Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 193, in Handle
result = handler(self._environ, self._StartResponse)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/gaesessions.py", line 472, in __call__
return self.app(environ, my_start_response)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/mywebapp2.py", line 1520, in __call__
response = self._internal_error(e)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/mywebapp2.py", line 1512, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/mywebapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/mywebapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/apps/xxx/ver.0/lib/appengine-toolkit/gaetk/mywebapp2.py", line 1073, in __call__
return handler.dispatch()
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2_extras/local.py", line 173, in __getattr__
return getattr(self._get_current_object(), name)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2_extras/local.py", line 136, in _get_current_object
raise RuntimeError('no object bound to %s' % self.__name__)

The scenario where this happened was the usage of raise webob.HTTPFound(location='...') instead of self.redirect