Reputation: 13
In web.py, I use web.seeother() to redirect to another page, is there a way to transfer some message to that page too?
Upvotes: 0
Views: 589
Reputation: 26
You can pass globals to the template engine and link it to your session:
session = web.session.Session(app,web.session.DiskStore('sessions'), initializer={'message': ""})
render = web.template.render('templates/', globals={'context': session}, base='layout')
inside your template:
$if context.message:
<div id="messageBox">
$context.message
</div>
Something like that.
Upvotes: 1
Reputation: 11
you can use a Get Variable: web.seeother('/somepage?message=hello')
bye
Upvotes: 0