Skip to content

Commit

Permalink
Replace SourceStamp's getHTMLDict() with asDict() (see buildbot#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed Apr 5, 2010
1 parent b1f2805 commit b0a9da2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
12 changes: 0 additions & 12 deletions buildbot/sourcestamp.py
Expand Up @@ -141,18 +141,6 @@ def getText(self):
text.append("[patch]")
return text

def getHTMLDict(self):
if self.revision is None:
return dict(rev='latest')
d = dict(rev=self.revision)
if self.branch:
d['branch'] = self.branch
if self.patch:
d['patch'] = True
d['repository'] = self.repository
d['project'] = self.project
return d

def asDict(self):
result = {}
# Constant
Expand Down
7 changes: 4 additions & 3 deletions buildbot/status/web/grid.py
Expand Up @@ -2,6 +2,7 @@

from buildbot.status.web.base import HtmlResource
from buildbot.status.web.base import build_get_class, path_to_builder, path_to_build
from buildbot.sourcestamp import SourceStamp

class ANYBRANCH: pass # a flag value, used below

Expand Down Expand Up @@ -142,8 +143,8 @@ def content(self, request, cxt):
cxt.update({'categories': categories,
'branch': branch,
'ANYBRANCH': ANYBRANCH,
'stamps': stamps,
})
'stamps': map(SourceStamp.asDict, stamps)
})

sortedBuilderNames = status.getBuilderNames()[:]
sortedBuilderNames.sort()
Expand Down Expand Up @@ -201,7 +202,7 @@ def content(self, request, cxt):
cxt.update({'categories': categories,
'branch': branch,
'ANYBRANCH': ANYBRANCH,
'stamps': stamps,
'stamps': map(SourceStamp.asDict, stamps),
})

sortedBuilderNames = status.getBuilderNames()[:]
Expand Down
2 changes: 1 addition & 1 deletion buildbot/status/web/templates/grid.html
Expand Up @@ -13,7 +13,7 @@ <h1>Grid View</h1>
</td>

{% for s in stamps %}
{{ grid.stamp_td(**s.getHTMLDict()) }}
{{ grid.stamp_td(s) }}
{% endfor %}
</tr>

Expand Down
10 changes: 6 additions & 4 deletions buildbot/status/web/templates/grid_macros.html
Expand Up @@ -17,11 +17,13 @@
{%- endmacro %}


{% macro stamp_td(rev, branch=None, patch=False, project='', repository='') -%}
{% macro stamp_td(ss) -%}
<td valign="bottom" class="sourcestamp">
{{- rev|shortrev(repository) }}
{%- if branch %} in {{ branch }}{% endif %}
{%- if patch %} [patch]{% endif %}
{%- if ss.revision -%}
{{ ss.revision|shortrev(ss.repository) }}
{%- else %}latest{% endif %}
{%- if ss.branch %} in {{ ss.branch|e }}{% endif %}
{%- if ss.hasPatch %} [patch]{% endif %}
</td>
{%- endmacro %}

Expand Down
2 changes: 1 addition & 1 deletion buildbot/status/web/templates/grid_transposed.html
Expand Up @@ -18,7 +18,7 @@ <h1>Transposed Grid View</h1>

{% for i in range %}
<tr>
{{ grid.stamp_td(**stamps[i].getHTMLDict()) }}
{{ grid.stamp_td(stamps[i]) }}
{% for b in builder_builds %}
{{ grid.build_td(b[i]) }}
{% endfor %}
Expand Down

0 comments on commit b0a9da2

Please sign in to comment.