<ul class="archive">
{% for entry in entries %}
<li>
- <div class="title"><a href="/entry/{{ entry.slug }}">{{ escape(entry.title) }}</a></div>
- <div class="date">{{ locale.format_date(entry.published, full_format=True, shorter=True) }}</div>
+ <div class="title"><a href="/entry/{{ entry.slug }}">{{ escape(entry.title) }}</a></div>
+ <div class="date">{{ locale.format_date(entry.published, full_format=True, shorter=True) }}</div>
</li>
{% end %}
</ul>
<body>
<div id="body">
<div id="header">
- <div style="float:right">
- {% if not current_user %}
- {{ _('<a href="%(url)s">Sign in</a> to compose/edit') % {"url": escape(users.create_login_url(request.uri))} }}
- {% else %}
- {% if current_user.administrator %}
- <a href="/compose">{{ _("New post") }}</a> -
- {% end %}
- <a href="{{ escape(users.create_logout_url(request.uri)) }}">{{ _("Sign out") }}</a>
- {% end %}
- </div>
- <h1><a href="/">{{ escape(handler.settings["blog_title"]) }}</a></h1>
+ <div style="float:right">
+ {% if not current_user %}
+ {{ _('<a href="%(url)s">Sign in</a> to compose/edit') % {"url": escape(users.create_login_url(request.uri))} }}
+ {% else %}
+ {% if current_user.administrator %}
+ <a href="/compose">{{ _("New post") }}</a> -
+ {% end %}
+ <a href="{{ escape(users.create_logout_url(request.uri)) }}">{{ _("Sign out") }}</a>
+ {% end %}
+ </div>
+ <h1><a href="/">{{ escape(handler.settings["blog_title"]) }}</a></h1>
</div>
<div id="content">{% block body %}{% end %}</div>
</div>
<updated>{{ entry.updated.strftime(date_format) }}</updated>
<published>{{ entry.published.strftime(date_format) }}</published>
<content type="xhtml" xml:base="http://{{ request.host }}/">
- <div xmlns="http://www.w3.org/1999/xhtml">{{ entry.html }}</div>
+ <div xmlns="http://www.w3.org/1999/xhtml">{{ entry.html }}</div>
</content>
</entry>
{% end %}
<ul class="archive">
{% for entry in entries %}
<li>
- <div class="title"><a href="/entry/{{ entry.slug }}">{{ escape(entry.title) }}</a></div>
- <div class="date">{{ locale.format_date(entry.published, full_format=True, shorter=True) }}</div>
+ <div class="title"><a href="/entry/{{ entry.slug }}">{{ escape(entry.title) }}</a></div>
+ <div class="date">{{ locale.format_date(entry.published, full_format=True, shorter=True) }}</div>
</li>
{% end %}
</ul>
<body>
<div id="body">
<div id="header">
- <div style="float:right">
- {% if current_user %}
- <a href="/compose">{{ _("New post") }}</a> -
- <a href="/auth/logout?next={{ url_escape(request.uri) }}">{{ _("Sign out") }}</a>
- {% else %}
- {{ _('<a href="%(url)s">Sign in</a> to compose/edit') % {"url": "/auth/login?next=" + url_escape(request.uri)} }}
- {% end %}
- </div>
- <h1><a href="/">{{ escape(handler.settings["blog_title"]) }}</a></h1>
+ <div style="float:right">
+ {% if current_user %}
+ <a href="/compose">{{ _("New post") }}</a> -
+ <a href="/auth/logout?next={{ url_escape(request.uri) }}">{{ _("Sign out") }}</a>
+ {% else %}
+ {{ _('<a href="%(url)s">Sign in</a> to compose/edit') % {"url": "/auth/login?next=" + url_escape(request.uri)} }}
+ {% end %}
+ </div>
+ <h1><a href="/">{{ escape(handler.settings["blog_title"]) }}</a></h1>
</div>
<div id="content">{% block body %}{% end %}</div>
</div>
<updated>{{ entry.updated.strftime(date_format) }}</updated>
<published>{{ entry.published.strftime(date_format) }}</published>
<content type="xhtml" xml:base="http://{{ request.host }}/">
- <div xmlns="http://www.w3.org/1999/xhtml">{{ entry.html }}</div>
+ <div xmlns="http://www.w3.org/1999/xhtml">{{ entry.html }}</div>
</content>
</entry>
{% end %}
if (!window.console.log) window.console.log = function() {};
$("#messageform").live("submit", function() {
- newMessage($(this));
- return false;
+ newMessage($(this));
+ return false;
});
$("#messageform").live("keypress", function(e) {
- if (e.keyCode == 13) {
- newMessage($(this));
- return false;
- }
+ if (e.keyCode == 13) {
+ newMessage($(this));
+ return false;
+ }
});
$("#message").select();
updater.poll();
var disabled = form.find("input[type=submit]");
disabled.disable();
$.postJSON("/a/message/new", message, function(response) {
- updater.showMessage(response);
- if (message.id) {
- form.parent().remove();
- } else {
- form.find("input[type=text]").val("").select();
- disabled.enable();
- }
+ updater.showMessage(response);
+ if (message.id) {
+ form.parent().remove();
+ } else {
+ form.find("input[type=text]").val("").select();
+ disabled.enable();
+ }
});
}
jQuery.postJSON = function(url, args, callback) {
args._xsrf = getCookie("_xsrf");
$.ajax({url: url, data: $.param(args), dataType: "text", type: "POST",
- success: function(response) {
- if (callback) callback(eval("(" + response + ")"));
+ success: function(response) {
+ if (callback) callback(eval("(" + response + ")"));
}, error: function(response) {
- console.log("ERROR:", response)
+ console.log("ERROR:", response)
}});
};
var fields = this.serializeArray();
var json = {}
for (var i = 0; i < fields.length; i++) {
- json[fields[i].name] = fields[i].value;
+ json[fields[i].name] = fields[i].value;
}
if (json.next) delete json.next;
return json;
cursor: null,
poll: function() {
- var args = {"_xsrf": getCookie("_xsrf")};
- if (updater.cursor) args.cursor = updater.cursor;
- $.ajax({url: "/a/message/updates", type: "POST", dataType: "text",
- data: $.param(args), success: updater.onSuccess,
- error: updater.onError});
+ var args = {"_xsrf": getCookie("_xsrf")};
+ if (updater.cursor) args.cursor = updater.cursor;
+ $.ajax({url: "/a/message/updates", type: "POST", dataType: "text",
+ data: $.param(args), success: updater.onSuccess,
+ error: updater.onError});
},
onSuccess: function(response) {
- try {
- updater.newMessages(eval("(" + response + ")"));
- } catch (e) {
- updater.onError();
- return;
- }
- updater.errorSleepTime = 500;
- window.setTimeout(updater.poll, 0);
+ try {
+ updater.newMessages(eval("(" + response + ")"));
+ } catch (e) {
+ updater.onError();
+ return;
+ }
+ updater.errorSleepTime = 500;
+ window.setTimeout(updater.poll, 0);
},
onError: function(response) {
- updater.errorSleepTime *= 2;
- console.log("Poll error; sleeping for", updater.errorSleepTime, "ms");
- window.setTimeout(updater.poll, updater.errorSleepTime);
+ updater.errorSleepTime *= 2;
+ console.log("Poll error; sleeping for", updater.errorSleepTime, "ms");
+ window.setTimeout(updater.poll, updater.errorSleepTime);
},
newMessages: function(response) {
- if (!response.messages) return;
- updater.cursor = response.cursor;
- var messages = response.messages;
- updater.cursor = messages[messages.length - 1].id;
- console.log(messages.length, "new messages, cursor:", updater.cursor);
- for (var i = 0; i < messages.length; i++) {
- updater.showMessage(messages[i]);
- }
+ if (!response.messages) return;
+ updater.cursor = response.cursor;
+ var messages = response.messages;
+ updater.cursor = messages[messages.length - 1].id;
+ console.log(messages.length, "new messages, cursor:", updater.cursor);
+ for (var i = 0; i < messages.length; i++) {
+ updater.showMessage(messages[i]);
+ }
},
showMessage: function(message) {
- var existing = $("#m" + message.id);
- if (existing.length > 0) return;
- var node = $(message.html);
- node.hide();
- $("#inbox").append(node);
- node.slideDown();
+ var existing = $("#m" + message.id);
+ if (existing.length > 0) return;
+ var node = $(message.html);
+ node.hide();
+ $("#inbox").append(node);
+ node.slideDown();
}
};
</div>
<div id="body">
<div id="inbox">
- {% for message in messages %}
+ {% for message in messages %}
{% include "message.html" %}
- {% end %}
+ {% end %}
</div>
<div id="input">
- <form action="/a/message/new" method="post" id="messageform">
- <table>
- <tr>
- <td><input name="body" id="message" style="width:500px"/></td>
- <td style="padding-left:5px">
- <input type="submit" value="{{ _("Post") }}"/>
- <input type="hidden" name="next" value="{{ request.path }}"/>
- {{ xsrf_form_html() }}
- </td>
- </tr>
- </table>
- </form>
+ <form action="/a/message/new" method="post" id="messageform">
+ <table>
+ <tr>
+ <td><input name="body" id="message" style="width:500px"/></td>
+ <td style="padding-left:5px">
+ <input type="submit" value="{{ _("Post") }}"/>
+ <input type="hidden" name="next" value="{{ request.path }}"/>
+ {{ xsrf_form_html() }}
+ </td>
+ </tr>
+ </table>
+ </form>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<body>
<div id="body">
<div style="float:right">
- <b>{{ escape(current_user["name"]) }}</b> -
- <a href="/auth/logout">{{ _("Sign out") }}</a>
+ <b>{{ escape(current_user["name"]) }}</b> -
+ <a href="/auth/logout">{{ _("Sign out") }}</a>
</div>
<div style="margin-bottom:1em"><a href="/">{{ _("Refresh stream") }}</a></div>
<div id="stream">
- {% for post in stream["posts"] %}
+ {% for post in stream["posts"] %}
{{ modules.Post(post, stream["profiles"][post["actor_id"]]) }}
- {% end %}
+ {% end %}
</div>
</div>
</body>
static PyObject* _epoll_create(void) {
int fd = epoll_create(MAX_EVENTS);
if (fd == -1) {
- PyErr_SetFromErrno(PyExc_Exception);
- return NULL;
+ PyErr_SetFromErrno(PyExc_Exception);
+ return NULL;
}
return PyInt_FromLong(fd);
event.events = events;
event.data.fd = fd;
if (epoll_ctl(epfd, op, fd, &event) == -1) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
+ PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
}
Py_INCREF(Py_None);
num_events = epoll_wait(epfd, events, MAX_EVENTS, timeout);
Py_END_ALLOW_THREADS
if (num_events == -1) {
- PyErr_SetFromErrno(PyExc_Exception);
- return NULL;
+ PyErr_SetFromErrno(PyExc_Exception);
+ return NULL;
}
list = PyList_New(num_events);
for (i = 0; i < num_events; i++) {
- tuple = PyTuple_New(2);
- PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(events[i].data.fd));
- PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(events[i].events));
- PyList_SET_ITEM(list, i, tuple);
+ tuple = PyTuple_New(2);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(events[i].data.fd));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(events[i].events));
+ PyList_SET_ITEM(list, i, tuple);
}
return list;
}
tocext = TocTreeprocessor(md)
tocext.config = self.config
md.treeprocessors.add("toc", tocext, "_begin")
-
+
def makeExtension(configs={}):
return TocExtension(configs=configs)
<body>
<div id="body">
<div id="header">
- <table>
- <tr>
- <td class="logo"><a href="/"><img src="/static/tornado.png" alt="Tornado"/></a></td>
- <td class="title">{% block headertitle %}{% end %}</td>
- </tr>
- </table>
+ <table>
+ <tr>
+ <td class="logo"><a href="/"><img src="/static/tornado.png" alt="Tornado"/></a></td>
+ <td class="title">{% block headertitle %}{% end %}</td>
+ </tr>
+ </table>
</div>
<div id="content">{% block body %}{% end %}</div>
<div id="footer">
- <div>Tornado is one of <a href="http://developers.facebook.com/opensource.php">Facebook's open source technologies</a>. It is available under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Licence, Version 2.0</a>.</div>
- <div>This web site and all documentation is licensed under <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons 3.0</a>.</div>
+ <div>Tornado is one of <a href="http://developers.facebook.com/opensource.php">Facebook's open source technologies</a>. It is available under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Licence, Version 2.0</a>.</div>
+ <div>This web site and all documentation is licensed under <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons 3.0</a>.</div>
</div>
</div>
{% block bottom %}{% end %}
<h2>Discussion and support</h2>
<p>You can discuss Tornado and report bugs on <a href="http://groups.google.com/group/python-tornado">the Tornado developer mailing list</a>.
-
+
<h2>Updates</h2>
<p>Follow us on <a href="http://www.facebook.com/pages/Tornado-Web-Server/144144048921">Facebook</a>, <a href="http://twitter.com/tornadoweb">Twitter</a>, or <a href="http://friendfeed.com/tornado-web">FriendFeed</a> to get updates and announcements:</p>
<div style="margin-top:1em"><a href="http://www.facebook.com/pages/Tornado-Web-Server/144144048921" style="margin-right:10px"><img src="/static/facebook.png" style="width:64px;height:64px" alt="Facebook"/></a><a href="http://twitter.com/tornadoweb" style="margin-right:10px"><img src="/static/twitter.png" style="width:64px;height:64px" alt="Twitter"/></a><a href="http://friendfeed.com/tornado-web" style="margin-right:10px"><img src="/static/friendfeed.png" style="width:64px;height:64px" alt="Facebook"/></a></div>