[rhmessaging-commits] rhmessaging commits: r1553 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Jan 11 12:43:52 EST 2008


Author: justi9
Date: 2008-01-11 12:43:52 -0500 (Fri, 11 Jan 2008)
New Revision: 1553

Modified:
   mgmt/cumin/python/cumin/stat.py
   mgmt/cumin/python/cumin/stat.strings
Log:
Display the unit with the current value.



Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py	2008-01-11 17:30:05 UTC (rev 1552)
+++ mgmt/cumin/python/cumin/stat.py	2008-01-11 17:43:52 UTC (rev 1553)
@@ -101,7 +101,9 @@
     def render_stats(self, session, object):
         writer = Writer()
 
-        for stat in self.stats:
+        for name in self.stats:
+            cls = self.app.model.get_class_by_object(object)
+            stat = cls.get_stat(name)
             self.stats_tmpl.render(session, (stat, object), writer)
 
         return writer.to_string()
@@ -111,9 +113,13 @@
 
     def render_stat_value(self, session, args):
         stat, object = args
-        cls = self.app.model.get_class_by_object(object)
-        return cls.get_stat(stat).value_html(object)
+        return stat.value_html(object)
 
+    def render_stat_unit(self, session, args):
+        stat, object = args
+        value = stat.value(object)
+        return "%s%s" % (stat.unit, ess(value))
+
 class StatChartPage(Page):
     def __init__(self, app, name):
         super(StatChartPage, self).__init__(app, name)

Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings	2008-01-11 17:30:05 UTC (rev 1552)
+++ mgmt/cumin/python/cumin/stat.strings	2008-01-11 17:43:52 UTC (rev 1553)
@@ -114,5 +114,5 @@
 [StatValueChart.stat_html]
 <li>
   <span class="swatch" style="background-color: {stat_color}">&nbsp;</span>
-  {stat_value}
+  &nbsp; {stat_value} {stat_unit}
 </li>




More information about the rhmessaging-commits mailing list