Skip to content

Commit

Permalink
tgrid: Put default value of rev_order in a class variable.
Browse files Browse the repository at this point in the history
Avoids having the default value written twice
(prone to mistakes if it changes),
and allows easy monkey-patching of the default.
  • Loading branch information
nicolas17 committed Sep 23, 2010
1 parent 6e4dfed commit 4b4dffc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions master/buildbot/status/web/grid.py
Expand Up @@ -181,6 +181,7 @@ class TransposedGridStatusResource(HtmlResource, GridStatusMixin):
# TODO: docs
status = None
changemaster = None
default_rev_order = "asc"

def content(self, request, cxt):
"""This method builds the transposed grid display.
Expand All @@ -193,9 +194,9 @@ def content(self, request, cxt):
branch = request.args.get("branch", [ANYBRANCH])[0]
if branch == 'trunk': branch = None

rev_order = request.args.get("rev_order", ["asc"])[0]
rev_order = request.args.get("rev_order", [self.default_rev_order])[0]
if rev_order not in ["asc", "desc"]:
rev_order = "asc"
rev_order = self.default_rev_order

cxt['refresh'] = self.get_reload_time(request)

Expand Down

0 comments on commit 4b4dffc

Please sign in to comment.