How can I kill off a Python web app on GAE early following a redirect?
Posted
by Mike Hayes
on Stack Overflow
See other posts from Stack Overflow
or by Mike Hayes
Published on 2010-06-08T23:57:46Z
Indexed on
2010/06/09
0:02 UTC
Read the original article
Hit count: 219
Hi
Disclaimer: completely new to Python from a PHP background
Ok I'm using Python on Google App Engine with Google's webapp framework.
I have a function which I import as it contains things which need to be processed on each page.
def some_function(self):
if data['user'].new_user and not self.request.path == '/main/new':
self.redirect('/main/new')
This works fine when I call it, but how can I make sure the app is killed off after the redirection. I don't want anything else processing. For example I will do this:
class Dashboard(webapp.RequestHandler):
def get(self):
some_function(self)
#Continue with normal code here
self.response.out.write('Some output here')
I want to make sure that once the redirection is made in some_function() (which works fine), that no processing is done in the get() function following the redirection, nor is the "Some output here" outputted.
What should I be looking at to make this all work properly? I can't just exit the script because the webapp framework needs to run.
I realise that more than likely I'm just doing things in completely the wrong way any way for a Python app, so any guidance would be a great help. Hopefully I have explained myself properly and someone will be able to point me in the right direction.
Thanks
© Stack Overflow or respective owner