I am using Tornado and I have the following code:
class UserHandler(RequestHandler):
def get(self):
user = self.get_argument("username")
self.set_cookie("user", user)
out = tableize(user)
self.render('chat.html',table=out)
now, chatter.html looks like this:
<iframe src="{{ static_url('mess.html') }}" width="500" height="400"></iframe>
where mess.html is:
<div id="chat">
{% for x in table %}
<b> x </b>
{% end %}
</div>
My question is, how do I pass the ‘table’ argument to mess.html? I can’t figure out how to make it display properly.
Have a look at
{% include %}in the Tornado docs, it might do what you are trying to achieve. Instead of using an iframe, directly do{% include "mess.html" %}.If you want to keep the independent frame so you can refresh individually, you have to consider the iframe being a separate request. As such, you also have to provide its own
RequestHandlerwhere you get your cookie and then generate the table for your user. You then set the iframe src to be the URL you chose for thisRequestHandler.