Author: justi9
Date: 2007-10-16 10:38:51 -0400 (Tue, 16 Oct 2007)
New Revision: 1082
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/Todo
Log:
Adds a set_object to CuminFrame and uses it instead of specific
methods on every instance of CuminFrame.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -46,6 +46,7 @@
self.param = ClusterParameter(app, "id")
self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
self.view = ClusterView(app, "view")
self.add_mode(self.view)
@@ -56,21 +57,15 @@
self.vhost = VirtualHostFrame(app, "vhost")
self.add_mode(self.vhost)
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_cluster(self, session, cluster):
- self.param.set(session, cluster)
-
def show_view(self, session):
return self.show_mode(session, self.view)
def show_server(self, session, server):
- self.server.set_server(session, server)
+ self.server.set_object(session, server)
return self.show_mode(session, self.server)
def show_virtual_host(self, session, vhost):
- self.vhost.set_virtual_host(session, vhost)
+ self.vhost.set_object(session, vhost)
return self.show_mode(session, self.vhost)
def render_title(self, session, cluster):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -61,16 +61,11 @@
self.param = ExchangeParameter(app, "id")
self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
self.view = ExchangeView(app, "view")
self.add_mode(self.view)
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_exchange(self, session, exchange):
- return self.param.set(session, exchange)
-
def show_view(self, session):
return self.show_mode(session, self.view)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/page.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -68,7 +68,7 @@
frame = frame.show_server(session, server)
else:
frame = self.show_mode(session, self.server)
- frame.set_server(session, server)
+ frame.set_object(session, server)
return self.page().set_current_frame(session, frame)
@@ -84,12 +84,12 @@
def show_server_group_edit(self, session, group):
frame = self.show_mode(session, self.group_edit)
- frame.set_server_group(session, group)
+ frame.set_object(session, group)
return self.page().set_current_frame(session, frame)
def show_cluster(self, session, cluster):
frame = self.show_mode(session, self.cluster)
- frame.set_cluster(session, cluster)
+ frame.set_object(session, cluster)
return self.page().set_current_frame(session, frame)
def show_virtual_host(self, session, vhost):
@@ -157,7 +157,7 @@
def show_server_group(self, session, group):
mode = self.show_mode(session, self.servers)
- mode.set_server_group(session, group)
+ mode.set_object(session, group)
return mode
def render_title(self, session, model):
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -64,16 +64,11 @@
self.param = QueueParameter(app, "id")
self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
self.view = QueueView(app, "view")
self.add_mode(self.view)
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_queue(self, session, queue):
- return self.param.set(session, queue)
-
def show_view(self, session):
return self.show_mode(session, self.view)
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -44,6 +44,7 @@
self.param = ServerParameter(app, "id")
self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
self.view = ServerView(app, "view")
self.add_mode(self.view)
@@ -54,17 +55,11 @@
self.prop = ServerConfigPropertyForm(app, "prop")
self.add_mode(self.prop)
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_server(self, session, server):
- self.param.set(session, server)
-
def show_view(self, session):
return self.show_mode(session, self.view)
def show_virtual_host(self, session, vhost):
- self.vhost.set_virtual_host(session, vhost)
+ self.vhost.set_object(session, vhost)
return self.show_mode(session, self.vhost)
def show_config_property(self, session, prop):
@@ -254,7 +249,7 @@
def get_object(self, session, object):
return self.param.get(session)
- def set_server_group(self, session, group):
+ def set_object(self, session, group):
return self.param.set(session, group)
def render_title(self, session, group):
@@ -264,7 +259,7 @@
class_ = group is None and "selected"
branch = session.branch()
- self.set_server_group(branch, None)
+ self.set_object(branch, None)
return link(branch.marshal(), "All Servers", class_)
def render_add_group_href(self, session, group):
@@ -380,7 +375,7 @@
def get_object(self, session, object):
return self.param.get(session)
- def set_server_group(self, session, group):
+ def set_object(self, session, group):
self.param.set(session, group)
def process_display(self, session, group):
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -34,6 +34,7 @@
self.param = VirtualHostParameter(app, "id")
self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
self.queue = QueueFrame(app, "queue")
self.add_mode(self.queue)
@@ -44,21 +45,15 @@
self.view = VirtualHostView(app, "view")
self.add_mode(self.view)
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_virtual_host(self, session, vhost):
- return self.param.set(session, vhost)
-
def show_view(self, session):
return self.show_mode(session, self.view)
def show_queue(self, session, queue):
- self.queue.set_queue(session, queue)
+ self.queue.set_object(session, queue)
return self.show_mode(session, self.queue)
def show_exchange(self, session, exchange):
- self.exchange.set_exchange(session, exchange)
+ self.exchange.set_object(session, exchange)
return self.show_mode(session, self.exchange)
def render_title(self, session, vhost):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-16 14:38:51 UTC (rev 1082)
@@ -15,6 +15,20 @@
return "<span class=\"none\">None</span>"
class CuminFrame(Frame, ModeSet):
+ def __init__(self, app, name):
+ super(CuminFrame, self).__init__(app, name)
+
+ self.param = None
+
+ def set_object_parameter(self, param):
+ self.param = param
+
+ def get_object(self, session, object):
+ return self.param.get(session)
+
+ def set_object(self, session, object):
+ return self.param.set(session, object)
+
def show_view(self, session):
pass
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-16 12:52:04 UTC (rev 1081)
+++ mgmt/notes/Todo 2007-10-16 14:38:51 UTC (rev 1082)
@@ -48,9 +48,6 @@
* cumindev: add a cumin-test function and bind it to C-c C-c
- * Consider adding a set_object to CuminFrame, instead of having
- set_somethingspecific on each frame.
-
* Consider having a cssclass set on widgets
* Use page attributes for session errors, redirect