Skip to content

Commit

Permalink
Made footer into template + minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed May 7, 2009
1 parent e55f63b commit ed64fd0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
3 changes: 1 addition & 2 deletions buildbot/status/web/about.py
Expand Up @@ -15,5 +15,4 @@ def body(self, request):
twisted=twisted.__version__,
jinja=jinja2.__version__,
python=sys.version,
platform=sys.platform);

platform=sys.platform)
43 changes: 12 additions & 31 deletions buildbot/status/web/base.py
Expand Up @@ -275,13 +275,13 @@ def getControl(self, request):
return request.site.buildbot_service.getControl()

def isUsingUserPasswd(self, request):
return request.site.buildbot_service.isUsingUserPasswd()
return request.site.buildbot_service.isUsingUserPasswd()

def authUser(self, request):
user = request.args.get("username", ["<unknown>"])[0]
passwd = request.args.get("passwd", ["<no-password>"])[0]
if user == "<unknown>" or passwd == "<no-password>":
return False
user = request.args.get("username", ["<unknown>"])[0]
passwd = request.args.get("passwd", ["<no-password>"])[0]
if user == "<unknown>" or passwd == "<no-password>":
return False
return request.site.buildbot_service.authUser(user, passwd)

def getChangemaster(self, request):
Expand All @@ -291,32 +291,13 @@ def path_to_root(self, request):
return path_to_root(request)

def footer(self, s, req):
# TODO: this stuff should be generated by a template of some sort
projectURL = s.getProjectURL()
projectName = s.getProjectName()
data = '<hr /><div class="footer">\n'

welcomeurl = self.path_to_root(req) + "index.html"
data += '[<a href="%s">welcome</a>]\n' % welcomeurl
data += "<br />\n"

data += '<a href="http://buildbot.sourceforge.net/">Buildbot</a>'
data += "-%s " % version
if projectName:
data += "working for the "
if projectURL:
data += "<a href=\"%s\">%s</a> project." % (projectURL,
projectName)
else:
data += "%s project." % projectName
data += "<br />\n"
data += ("Page built: " +
time.strftime("%a %d %b %Y %H:%M:%S",
time.localtime(util.now()))
+ "\n")
data += '</div>\n'

return data
template = env.get_template("footer.html")
return template.render(projectURL = s.getProjectURL(),
projectName = s.getProjectName(),
welcomeurl = self.path_to_root(req) + "index.html",
version = version,
time = time.strftime("%a %d %b %Y %H:%M:%S",
time.localtime(util.now())))

def getTitle(self, request):
return self.title
Expand Down
4 changes: 2 additions & 2 deletions buildbot/status/web/templates/about.html
Expand Up @@ -5,8 +5,8 @@ <h2>Version Information</h2>
<li>Buildbot: {{ buildbot }}</li>
<li>Twisted: {{ twisted }}</li>
<li>Jinja: {{ jinja }}</li>
<li>Python: {{ python}}</li>
<li>Buildmaster platform: {{ platform}}</li>
<li>Python: {{ python }}</li>
<li>Buildmaster platform: {{ platform }}</li>

</ul>

Expand Down
23 changes: 23 additions & 0 deletions buildbot/status/web/templates/footer.html
@@ -0,0 +1,23 @@
<hr />
<div class="footer">

<a href="{{ welcomeurl }}">welcome</a>
<br />

<a href="http://buildbot.sourceforge.net/">Buildbot</a>-{{ version }}

{% if projectName %}
working for the
{% if projectURL %}
<a href="{{ projectURL }}>{{ projectName }}</a>
{% else %}
{{ projectName }}
{% end if %}
project
{% end if %}
<br />
Page built: {{ time }}
</div>

0 comments on commit ed64fd0

Please sign in to comment.