]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Use autoescape in websocket chat demo.
authorBen Darnell <ben@bendarnell.com>
Sun, 3 Mar 2013 17:23:28 +0000 (12:23 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 3 Mar 2013 17:23:28 +0000 (12:23 -0500)
demos/websocket/chatdemo.py
demos/websocket/templates/index.html
demos/websocket/templates/message.html

index e2bd5f643addb4a5b7ea0223139e4ecf4c37f3a6..a62313936c0212a828f343dd0c2135a76c3af20d 100755 (executable)
@@ -43,7 +43,6 @@ class Application(tornado.web.Application):
             template_path=os.path.join(os.path.dirname(__file__), "templates"),
             static_path=os.path.join(os.path.dirname(__file__), "static"),
             xsrf_cookies=True,
-            autoescape=None,
         )
         tornado.web.Application.__init__(self, handlers, **settings)
 
index 68721e7eefbc3d8c8841c389480bf36b7a171955..6b367492864110b6c8e947e858a827d27955b4a4 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <title>Tornado Chat Demo</title>
     <link rel="stylesheet" href="{{ static_url("chat.css") }}" type="text/css"/>
   </head>
@@ -20,7 +20,7 @@
               <td style="padding-left:5px">
                 <input type="submit" value="{{ _("Post") }}"/>
                 <input type="hidden" name="next" value="{{ request.path }}"/>
-                {{ xsrf_form_html() }}
+                {% module xsrf_form_html() %}
               </td>
             </tr>
           </table>
index 612f4cf34f7870cfb7a6301f01775d2e090c343a..aa817fdfa8b1fd37431cfb6bcb905ce440a34ace 100644 (file)
@@ -1,2 +1 @@
-{% import tornado.escape %}
-<div class="message" id="m{{ message["id"] }}">{{ tornado.escape.linkify(message["body"]) }}</div>
+<div class="message" id="m{{ message["id"] }}">{% module linkify(message["body"]) %}</div>