[rhmessaging-commits] rhmessaging commits: r1538 - in mgmt/cumin/python: wooly and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Jan 7 10:48:52 EST 2008


Author: justi9
Date: 2008-01-07 10:48:52 -0500 (Mon, 07 Jan 2008)
New Revision: 1538

Modified:
   mgmt/cumin/python/cumin/charts.py
   mgmt/cumin/python/cumin/stat.py
   mgmt/cumin/python/wooly/__init__.py
   mgmt/cumin/python/wooly/server.py
Log:
Adds a no-cache directive to the chart png page.

Formats y-axis values, shortens them.



Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py	2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/cumin/charts.py	2008-01-07 15:48:52 UTC (rev 1538)
@@ -82,9 +82,15 @@
             cr.line_to(self.width + 2, y)
 
             if i % 2 == 0:
-                value = self.y_max - (self.y_max * y / float(self.height))
-                cr.show_text(str(value))
+                value = int(self.y_max - (self.y_max * y / float(self.height)))
 
+                if value > 10000:
+                    svalue = "%ik" % (value / 1000)
+                else:
+                    svalue = str(value)
+
+                cr.show_text(svalue)
+
             i += 1
 
         self.stroke(cr)

Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py	2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/cumin/stat.py	2008-01-07 15:48:52 UTC (rev 1538)
@@ -113,6 +113,9 @@
     def get_content_type(self, session):
         return "image/png"
 
+    def get_cache_control(self, session):
+        return "no-cache"
+
     def do_render(self, session, object):
         chart = LineChart(480, 120)
 

Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py	2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/wooly/__init__.py	2008-01-07 15:48:52 UTC (rev 1538)
@@ -343,6 +343,9 @@
     def get_content_type(self, session):
         return "text/html"
 
+    def get_cache_control(self, session):
+        return None
+
     def save_session(self, session):
         pass
 

Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py	2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/wooly/server.py	2008-01-07 15:48:52 UTC (rev 1538)
@@ -6,6 +6,7 @@
 from wooly import *
 from devel import DevelPage
 
+
 class WebServer(object):
     def __init__(self, app, port=8080):
         self.app = app
@@ -86,15 +87,20 @@
 
             self.send_response(200)
 
+            if modified:
+                ts = modified.strftime("%a, %d %b %Y %H:%M:%S GMT")
+                self.send_header("Last-Modified", ts)
+
             type = page.get_content_type(session)
 
             if type:
                 self.send_header("Content-Type", type)
 
-            if modified:
-                ts = modified.strftime("%a, %d %b %Y %H:%M:%S GMT")
-                self.send_header("Last-Modified", ts)
+            cache = page.get_cache_control(session)
 
+            if cache:
+                self.send_header("Cache-Control", cache)
+
             self.end_headers()
 
             self.wfile.write(response)




More information about the rhmessaging-commits mailing list