[llvm-commits] [LNT] r161846 - in /lnt/trunk/lnt/server/ui: filters.py util.py

Daniel Dunbar daniel at zuster.org
Thu Aug 16 10:41:04 PDT 2012


On Mon, Aug 13, 2012 at 9:21 PM, Michael Gottesman <mgottesman at apple.com> wrote:
> 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.

Another thing we could do here is just turn any remaining kwargs into
attributes. That would make calling this with extra attributes even
simpler, and could subsume the style and class arguments (although we
have to have a hack to support some alternate name for "class").

 - Daniel

>
> 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())
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list