Commit a78f5784 by Tom Christie

Nicer formatting of status

parent abb55a49
from django.template import Context, loader
from django.core.handlers.wsgi import STATUS_CODE_TEXT
import json
class BaseEmitter(object):
......@@ -17,6 +18,7 @@ class TemplatedEmitter(BaseEmitter):
context = Context({
'content': content,
'status': self.status,
'reason': STATUS_CODE_TEXT.get(self.status, ''),
'headers': self.headers,
'resource_name': self.resource.__class__.__name__,
'resource_doc': self.resource.__doc__
......
......@@ -10,8 +10,8 @@
<body>
<h1>{{ resource_name }}</h1>
<p>{{ resource_doc }}</p>
<pre>{% autoescape off %}HTTP Status {{ status }}
{% for key, val in headers.items %}{{ key }}: {{ val }}
<pre>{% autoescape off %}<b>{{ status }} {{ reason }}</b>
{% for key, val in headers.items %}<b>{{ key }}:</b> {{ val }}
{% endfor %}
{{ content|urlize_quoted_links }}{% endautoescape %} </pre>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment