[llvm-commits] [LNT] r161846 - in /lnt/trunk/lnt/server/ui: filters.py util.py
Michael Gottesman
mgottesman at apple.com
Mon Aug 13 21:21:24 PDT 2012
Author: mgottesman
Date: Mon Aug 13 23:21:24 2012
New Revision: 161846
URL: http://llvm.org/viewvc/llvm-project?rev=161846&view=rev
Log:
[LNT] v4_global_status: Added code to filters.py/util.py so that arbitrary attributes can be
added to the resultant rendered cell. This is done via an attribute dictionary. I would just
remove the class/style arguments and just use attribute, but there is a lot of legacy code that
uses it and this is not the commit to fix that.
Modified:
lnt/trunk/lnt/server/ui/filters.py
lnt/trunk/lnt/server/ui/util.py
Modified: lnt/trunk/lnt/server/ui/filters.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/filters.py?rev=161846&r1=161845&r2=161846&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/filters.py (original)
+++ lnt/trunk/lnt/server/ui/filters.py Mon Aug 13 23:21:24 2012
@@ -9,9 +9,9 @@
ts = datetime.datetime.fromtimestamp(time)
return ts.strftime('%Y-%m-%d %H:%M:%S %Z PST')
-def filter_aspctcell(value, class_=None, style=None, *args, **kwargs):
+def filter_aspctcell(value, class_=None, style=None, attributes=None, *args, **kwargs):
cell = util.PctCell(value, *args, **kwargs)
- return cell.render(class_, style)
+ return cell.render(class_, style, attributes)
def filter_pprint(value):
stream = StringIO.StringIO()
Modified: lnt/trunk/lnt/server/ui/util.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/util.py?rev=161846&r1=161845&r2=161846&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/util.py (original)
+++ lnt/trunk/lnt/server/ui/util.py Mon Aug 13 23:21:24 2012
@@ -208,12 +208,15 @@
for v in self.getColor()]
return "#%02x%02x%02x" % (r,g,b)
- def render(self, class_=None, style=None):
+ def render(self, class_=None, style=None, attributes=None):
attrs = []
if style is not None:
attrs.append('style="%s"' % (style,))
if class_ is not None:
attrs.append('class="%s"' % (class_,))
+ if attributes is not None:
+ for key, value in attributes.items():
+ attrs.append('%s="%s"' % (key, value))
attrs.append('bgcolor="%s"' % (self.getColorString(),))
attr_string = ' '.join(attrs)
return '<td %s>%s</td>' % (attr_string, self.getValue())
More information about the llvm-commits
mailing list