Saturday 15 January 2011

python - How to make a page not directly accessible in Flask? -



python - How to make a page not directly accessible in Flask? -

i'm developing web application using flask microframework.

i'd have view accessible when redirected view , not straight users.

to create more clear:

@app.route('/', methods=('get', 'post')) @app.route('/home', methods=('get', 'post')) def home(): #some code homecoming redirect(url_for('inprogress', parameter) @app.route('/path/<parameter>') def inprogress(parameter): homecoming render_template(...)

the view inprogress should accessible when it's "called" home view.

is possible?

before issue redirect, set flag in session object. "inprogress" view should check flag. if it's set, groovy, render page. if it's not, redirect them page (and flash warning trying access page, optionally).

python flask

No comments:

Post a Comment