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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Oct 12 18:50:16 EDT 2007


Author: justi9
Date: 2007-10-12 18:50:16 -0400 (Fri, 12 Oct 2007)
New Revision: 1034

Modified:
   mgmt/cumin/python/cumin/page.py
   mgmt/cumin/python/wooly/__init__.py
   mgmt/cumin/python/wooly/devel.py
   mgmt/cumin/python/wooly/server.py
Log:
Makes the TabSet use a tab template instead of in-code html.
Disables debug stuff by default.



Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py	2007-10-12 22:20:26 UTC (rev 1033)
+++ mgmt/cumin/python/cumin/page.py	2007-10-12 22:50:16 UTC (rev 1034)
@@ -34,7 +34,8 @@
         self.modal.set(session, modal)
 
     def save_session(self, session):
-        self.app.sessions.append(session)
+        if self.app.debug:
+            self.app.debug.sessions.append(session)
 
     def show_server(self, session, server):
         cluster = server.get_cluster()

Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py	2007-10-12 22:20:26 UTC (rev 1033)
+++ mgmt/cumin/python/wooly/__init__.py	2007-10-12 22:50:16 UTC (rev 1034)
@@ -106,7 +106,8 @@
 
     def process(self, session, object):
         if session.debug:
-            call = WidgetCall(session.process_stack, self, session, object)
+            call = WidgetCall(session.debug.process_stack,
+                              self, session, object)
             call.open()
 
         self.do_process(session, object)
@@ -120,7 +121,8 @@
 
     def render(self, session, object):
         if session.debug:
-            call = WidgetCall(session.render_stack, self, session, object)
+            call = WidgetCall(session.debug.render_stack,
+                              self, session, object)
             call.open()
 
         string = self.do_render(session, object)
@@ -314,8 +316,16 @@
         self.finder = ResourceFinder()
         self.cached_css = None
 
-        self.sessions = list()
+        self.debug = None
 
+    def enable_debug(self):
+        self.debug = self.Debug(self)
+
+    class Debug(object):
+        def __init__(self, app):
+            self.app = app
+            self.sessions = list()
+
     def add_page(self, page):
         if page.parent:
             raise Exception("Page '%s' is not a root widget" % page.name)
@@ -381,18 +391,24 @@
         self.redirect = None
         self.saved_parameters = list()
 
-        self.debug = True
+        if self.app.debug:
+            self.debug = self.Debug(self)
+        else:
+            self.debug = None
 
-        self.process_stack = list()
-        self.render_stack = list()
+    class Debug(object):
+        def __init__(self, app):
+            self.app = app
+            self.process_stack = list()
+            self.render_stack = list()
 
-    def print_process_calls(self, out=sys.stdout):
-        if self.process_stack:
-            self.process_stack[0].write(out)
+        def print_process_calls(self, out=sys.stdout):
+            if self.process_stack:
+                self.process_stack[0].write(out)
 
-    def print_render_calls(self, out=sys.stdout):
-        if self.render_stack:
-            self.render_stack[0].write(out)
+        def print_render_calls(self, out=sys.stdout):
+            if self.render_stack:
+                self.render_stack[0].write(out)
 
     def branch(self):
         return Session(self.app, self)

Modified: mgmt/cumin/python/wooly/devel.py
===================================================================
--- mgmt/cumin/python/wooly/devel.py	2007-10-12 22:20:26 UTC (rev 1033)
+++ mgmt/cumin/python/wooly/devel.py	2007-10-12 22:50:16 UTC (rev 1034)
@@ -24,8 +24,8 @@
 
             writer.write("<ul>")
 
-            if self.app.sessions:
-                call = self.app.sessions[-1].render_stack[0]
+            if self.app.debug and self.app.debug.sessions:
+                call = self.app.debug.sessions[-1].render_stack[0]
                 self.render_call(session, call, writer)
 
             writer.write("</ul>")

Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py	2007-10-12 22:20:26 UTC (rev 1033)
+++ mgmt/cumin/python/wooly/server.py	2007-10-12 22:50:16 UTC (rev 1034)
@@ -107,10 +107,11 @@
             self.send_header("Content-Type", "text/plain")
             self.end_headers()
 
-            self.wfile.write("APPLICATION ERROR\n")
-            self.wfile.write("\n----- python trace -----\n")
-            print_exc(None, self.wfile)
-            self.wfile.write("\n----- process trace -----\n")
-            session.print_process_calls(self.wfile)
-            self.wfile.write("\n----- render trace -----\n")
-            session.print_render_calls(self.wfile)
+            if session.debug:
+                self.wfile.write("APPLICATION ERROR\n")
+                self.wfile.write("\n----- python trace -----\n")
+                print_exc(None, self.wfile)
+                self.wfile.write("\n----- process trace -----\n")
+                session.debug.print_process_calls(self.wfile)
+                self.wfile.write("\n----- render trace -----\n")
+                session.debug.print_render_calls(self.wfile)




More information about the rhmessaging-commits mailing list