Author: eallen
Date: 2009-11-19 17:12:15 -0500 (Thu, 19 Nov 2009)
New Revision: 3720
Modified:
mgmt/trunk/cumin/python/cumin/grid/main.py
mgmt/trunk/cumin/python/cumin/messaging/main.py
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Avoid loop in CuminView.do_process. Change to more descriptive names.
Modified: mgmt/trunk/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/main.py 2009-11-19 21:27:02 UTC (rev 3719)
+++ mgmt/trunk/cumin/python/cumin/grid/main.py 2009-11-19 22:12:15 UTC (rev 3720)
@@ -75,7 +75,7 @@
self.pool = PoolFrame(app, "pool")
self.add_mode(self.pool)
- self.sticky = self.pool.view
+ self.add_sticky_view(self.pool)
def render_title(self, session):
return "Grid"
Modified: mgmt/trunk/cumin/python/cumin/messaging/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/main.py 2009-11-19 21:27:02 UTC (rev 3719)
+++ mgmt/trunk/cumin/python/cumin/messaging/main.py 2009-11-19 22:12:15 UTC (rev 3720)
@@ -85,7 +85,7 @@
self.broker = BrokerFrame(app, "broker")
self.add_mode(self.broker)
- self.sticky = self.broker.view
+ self.add_sticky_view(self.broker)
self.broker_group = BrokerGroupFrame(app, "group")
self.add_mode(self.broker_group)
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-11-19 21:27:02 UTC (rev 3719)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-11-19 22:12:15 UTC (rev 3720)
@@ -73,10 +73,10 @@
return lsess.marshal()
def render_tab_href(self, session, tab):
- if tab.sticky:
+ if tab.sticky_view:
try:
obj = session.client_session.attributes["sticky_%s" %
tab.name]
- return tab.sticky.frame.get_href(session, obj)
+ return tab.sticky_view.frame.get_href(session, obj)
except KeyError:
pass
@@ -135,7 +135,7 @@
def __init__(self, app, name):
super(CuminFrame, self).__init__(app, name)
- self.sticky = None
+ self.sticky_view = None
self.object = None
self.__view = None
self.__add = None
@@ -169,6 +169,10 @@
self.show_object(branch, object)
return branch.marshal()
+ def add_sticky_view(self, frame):
+ self.sticky_view = frame.view
+ frame.view.sticky_frame = self
+
def render_href(self, session, *args):
branch = session.branch()
@@ -194,6 +198,7 @@
self.add_child(summary)
self.__frame_tmpl = Template(self, "frame_html")
+ self.sticky_frame = None
def render_script(self, session):
return None
@@ -229,14 +234,9 @@
return html
def do_process(self, session):
- for frame in self.ancestors:
- try:
- if frame.sticky == self:
- session.client_session.attributes["sticky_%s" % \
- frame.name] = self.frame.object.get(session)
- except AttributeError:
- pass
-
+ if self.sticky_frame:
+ session.client_session.attributes["sticky_%s" % \
+ self.sticky_frame.name] = self.frame.object.get(session)
super(CuminView, self).do_process(session)
class BackgroundInclude(Widget):
Show replies by date