Author: justi9
Date: 2008-01-17 17:48:44 -0500 (Thu, 17 Jan 2008)
New Revision: 1569
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Restores group filtering of the broker view to working. Removes some
old code.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-01-17 21:22:56 UTC (rev 1568)
+++ mgmt/cumin/python/cumin/broker.py 2008-01-17 22:48:44 UTC (rev 1569)
@@ -25,6 +25,10 @@
self.add_sql_column("id", "b.id")
self.add_sql_column("name", "b.name")
+ self.add_sql_join("broker_group_mapping bgm",
+ "bgm.broker_registration_id",
+ "b.id")
+
self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
self.add_form_parameter(self.ids)
@@ -487,29 +491,17 @@
return "Brokers %s" % fmt_count(BrokerRegistration.select().count())
class BrowserBrokers(BrokerSet):
- def do_get_items(self, session, model):
+ def get_where_sql(self, session):
+ elems = list()
group = self.parent.group.get(session)
- profile = self.parent.profile.get(session)
- cluster = self.parent.cluster.get(session)
+ #profile = self.parent.profile.get(session)
+ #cluster = self.parent.cluster.get(session)
- brokers = BrokerRegistration.select()
-
- if profile:
- brokers = brokers.filter \
- (BrokerRegistration.q.profileID == profile.id)
-
- if cluster:
- brokers = brokers.filter \
- (BrokerRegistration.q.clusterID == cluster.id)
-
if group:
- brokers = brokers.filter \
- (BrokerGroupMapping.q.brokerRegistrationID \
- == BrokerRegistration.q.id)
- brokers = brokers.filter \
- (BrokerGroupMapping.q.brokerGroupID == group.id)
+ elems.append("bgm.broker_group_id = %i" % group.id)
- return brokers
+ if elems:
+ return "where %s" % " and ".join(elems)
def render_none(self, session, model):
return fmt_none()
Show replies by date