Skip to content

Commit

Permalink
Convert StaticHTML and LastBuild to use jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed Dec 25, 2009
1 parent 921994f commit 217697e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 5 additions & 2 deletions buildbot/status/web/base.py
Expand Up @@ -286,8 +286,11 @@ def __init__(self, body, title):
HtmlResource.__init__(self)
self.bodyHTML = body
self.title = title
def body(self, request):
return self.bodyHTML
def content(self, request, cxt):
cxt['content'] = self.bodyHTML
cxt['title'] = self.title
template = request.site.buildbot_service.templates.get_template("empty.html")
return template.render(**cxt)

class DirectoryLister(static.DirectoryLister):
"""This variant of the static.DirectoryLister uses a template
Expand Down
6 changes: 4 additions & 2 deletions buildbot/status/web/baseweb.py
Expand Up @@ -34,8 +34,10 @@


class LastBuild(HtmlResource):
def body(self, request):
return "missing\n"
def context(self, request, context):
context['content'] = "missing"
template = request.site.buildbot_service.templates.get_template("empty.html")
return template.render(**cxt)

def getLastNBuilds(status, numbuilds, builders=[], branches=[]):
"""Return a list with the last few Builds, sorted by start time.
Expand Down
5 changes: 5 additions & 0 deletions buildbot/status/web/templates/empty.html
@@ -0,0 +1,5 @@
{% extends "layout.html" %}

{% block content %}
{{ content }}
{% endblock %}

0 comments on commit 217697e

Please sign in to comment.