Author: justi9
Date: 2007-10-14 09:11:12 -0400 (Sun, 14 Oct 2007)
New Revision: 1060
Modified:
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
Log:
Moves the set_object functionality off of Frame and on to CuminFrame.
There are cases where just the state-scoping of Frame is desirable.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-14 13:09:37 UTC (rev 1059)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-14 13:11:12 UTC (rev 1060)
@@ -15,14 +15,31 @@
return "<span class=\"none\">None</span>"
class CuminFrame(Frame, ModeSet):
- def do_process(self, session, object):
- self.page().get_frames(session).append(self)
+ def __init__(self, app, name):
+ super(CuminFrame, self).__init__(app, name)
- super(CuminFrame, self).do_process(session, object)
+ self.object = None
+ def set_object_attribute(self, attribute):
+ self.object = attribute
+
+ def get_object(self, session):
+ if self.object:
+ return self.object.get(session)
+
def show_view(self, session):
pass
+ def do_process(self, session, object):
+ self.page().get_frames(session).append(self)
+
+ new_object = self.get_object(session)
+ super(CuminFrame, self).do_process(session, new_object)
+
+ def do_render(self, session, object):
+ new_object = self.get_object(session)
+ return super(CuminFrame, self).do_render(session, new_object)
+
def render_href(self, session, vhost):
branch = session.branch()
self.page().set_current_frame(branch, self)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-14 13:09:37 UTC (rev 1059)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-14 13:11:12 UTC (rev 1060)
@@ -245,32 +245,12 @@
return string
class Frame(Widget):
- def __init__(self, app, name):
- super(Frame, self).__init__(app, name)
-
- self.object = None
-
- def set_object_attribute(self, attribute):
- self.object = attribute
-
- def get_object(self, session):
- if self.object:
- return self.object.get(session)
-
def get_saved_parameters(self, session):
frame = self.page().get_current_frame(session)
if self is frame or self in frame.ancestors():
return super(Frame, self).get_saved_parameters(session)
- def do_process(self, session, object):
- new_object = self.get_object(session)
- super(Frame, self).do_process(session, new_object)
-
- def do_render(self, session, object):
- new_object = self.get_object(session)
- return super(Frame, self).do_render(session, new_object)
-
class Page(Frame):
xml_content_type = "text/xml"
html_content_type = "text/html"