[rhmessaging-commits] rhmessaging commits: r4030 - in mgmt/newdata/cumin/python/cumin: grid and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Jun 16 15:06:25 EDT 2010


Author: justi9
Date: 2010-06-16 15:06:24 -0400 (Wed, 16 Jun 2010)
New Revision: 4030

Modified:
   mgmt/newdata/cumin/python/cumin/grid/scheduler.py
   mgmt/newdata/cumin/python/cumin/parameters.py
Log:
Remove unused (sqlobject-based) paramaters; fix random scheduler selection in submission form

Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.py	2010-06-16 18:27:31 UTC (rev 4029)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.py	2010-06-16 19:06:24 UTC (rev 4030)
@@ -73,33 +73,45 @@
     def __init__(self, app, name):
         super(SchedulerSelectField, self).__init__(app, name, None)
 
-        self.param = SchedulerParameter(app, "param")
+        self.param = IntegerParameter(app, "param")
         self.add_parameter(self.param)
 
+        cls = self.app.model.com_redhat_grid.Scheduler
+
+        self.object = ObjectAttribute(self, "object", cls, self.param)
+
         self.input = self.SchedulerOptions(app, "input", self.param)
         self.add_child(self.input)
 
     def get(self, session):
-        scheduler = self.param.get(session)
+        return self.object.get(session)
 
-        if not scheduler:
-            items = self.input.get_items(session)
+    def render_title(self, session):
+        return "Scheduler"
 
-            if items:
-                scheduler = choice(items)
+    class SchedulerOptions(OptionInputSet):
+        def do_process(self, session):
+            cls = self.app.model.com_redhat_grid.Scheduler
+            id = self.param.get(session)
 
-        return scheduler
+            if id is None:
+                items = self.get_items(session)
 
-    def render_title(self, session):
-        return "Scheduler"
+                if items:
+                    scheduler = choice(items)
+                    self.param.set(session, scheduler._id)
 
-    class SchedulerOptions(OptionInputSet):
+            super(SchedulerSelectField.SchedulerOptions, self).do_process \
+                (session)
+
         def do_get_items(self, session):
             collector = self.form.object.get(session)
 
             cls = self.app.model.com_redhat_grid.Scheduler
+
             if collector:
-                schedulers = cls.get_selection(session.cursor, Pool=collector.Pool)
+                schedulers = cls.get_selection \
+                    (session.cursor, Pool=collector.Pool)
             else:
                 schedulers = cls.get_selection(session.cursor)
 
@@ -112,7 +124,7 @@
             return item.Name
 
         def render_item_selected_attr(self, session, item):
-            if item is self.param.get(session):
+            if item._id == self.param.get(session):
                 return "selected=\"selected\""
 
 class SchedulerGeneralStatSet(StatSet):

Modified: mgmt/newdata/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/parameters.py	2010-06-16 18:27:31 UTC (rev 4029)
+++ mgmt/newdata/cumin/python/cumin/parameters.py	2010-06-16 19:06:24 UTC (rev 4030)
@@ -63,19 +63,6 @@
         finally:
             cursor.close()
 
-class VhostParameter(RosemaryObjectParameter):
-    def __init__(self, app, name):
-        cls = app.model.org_apache_qpid_broker.Vhost
-
-        super(VhostParameter, self).__init__(app, name, cls)
-
-class BindingParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Binding.get(int(string))
-
-    def do_marshal(self, binding):
-        return str(binding.id)
-
 class BrokerGroupParameter(Parameter):
     def do_unmarshal(self, string):
         if string == "__none__":
@@ -111,20 +98,6 @@
     def do_marshal(self, broker):
         return str(broker.id)
 
-class ConnectionParameter(Parameter):
-    def do_unmarshal(self, string):
-        return ClientConnection.get(int(string))
-
-    def do_marshal(self, conn):
-        return str(conn.id)
-
-class ConfigPropertyParameter(Parameter):
-    def do_unmarshal(self, string):
-        return ConfigProperty.get(int(string))
-
-    def do_marshal(self, prop):
-        return str(prop.id)
-
 class ExchangeParameter(Parameter):
     def do_unmarshal(self, string):
         return Exchange.get(int(string))
@@ -160,25 +133,12 @@
 class PeerParameter(LinkParameter):
     pass
 
-class PoolParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Pool(string)
-
-    def do_marshal(self, pool):
-        return str(pool._id)
-
 class CollectorGridAttribute(ObjectAssociateAttribute):
     def get_associate(self, session, collector):
         cls = self.app.model.com_redhat_grid.Grid
         grid = cls.get_object(session.cursor, Pool=collector.Pool)
         return grid
 
-class CollectorNegotiatorAttribute(ObjectAssociateAttribute):
-    def get_associate(self, session, collector):
-        cls = self.app.model.com_redhat_grid.Negotiator
-        negotiator = cls.get_object(session.cursor, Pool=collector.Pool)
-        return negotiator
-
 class QueueParameter(Parameter):
     def do_unmarshal(self, string):
         return Queue.get(int(string))
@@ -193,58 +153,9 @@
     def do_marshal(self, route):
         return str(route.id)
 
-class SchedulerParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Scheduler.get(int(string))
-
-    def do_marshal(self, sched):
-        return str(sched.id)
-
-class SessionParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Session.get(int(string))
-
-    def do_marshal(self, session):
-        return str(session.id)
-
-class SlotParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Slot.get(int(string))
-
-    def do_marshal(self, slot):
-        return str(slot.id)
-
-class SubmissionParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Submission.get(int(string))
-
-    def do_marshal(self, sub):
-        return str(sub.id)
-
-class SubmitterParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Submitter.get(int(string))
-
-    def do_marshal(self, sub):
-        return str(sub.id)
-
-class CollectorParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Collector.get(int(string))
-
-    def do_marshal(self, coll):
-        return str(coll.id)
-
 class NegotiatorParameter(Parameter):
     def do_unmarshal(self, string):
         return Negotiator.get(int(string))
 
     def do_marshal(self, neg):
         return str(neg.id)
-
-class SystemParameter(Parameter):
-    def do_unmarshal(self, string):
-        return Sysimage.get(int(string))
-
-    def do_marshal(self, session):
-        return str(session.id)



More information about the rhmessaging-commits mailing list