Author: eallen
Date: 2008-11-17 11:01:39 -0500 (Mon, 17 Nov 2008)
New Revision: 2821
Modified:
mgmt/trunk/cumin/python/cumin/limits.py
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Fix negotiator update when there is no negotiator.
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-11-17 15:25:14 UTC (rev 2820)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-11-17 16:01:39 UTC (rev 2821)
@@ -29,8 +29,9 @@
def get_negotiator(self, session):
#TODO: find better way to get the negotiator. from pool perhaps?
+ pool = self.frame.get_args(session)[0]
most_recent = None
- negotiators = Negotiator.select()
+ negotiators = Negotiator.select("pool='%s'" % pool.id)
for negotiator in negotiators:
if negotiator.managedBroker:
if not most_recent:
@@ -90,12 +91,14 @@
class LimitCount(AjaxField):
def get_url(self, session):
negotiator = self.parent.get_negotiator(session)
- if negotiator:
- return "call.xml?class=negotiator;id=%i;method=GetLimitCount" %
negotiator.id
+ return negotiator and \
+ "call.xml?class=negotiator;id=%i;method=GetLimitCount" %
negotiator.id
def get_title(self, session, title):
- return "%s <span id=\"%s\"><span
class='count'>(?)</span>%s</span>" % \
- (title, self.name, self.render_script(session))
+ script = self.render_script(session)
+ count = script and "?" or "0"
+ return "%s <span id=\"%s\"><span
class='count'>(%s)</span>%s</span>" % \
+ (title, self.name, count, script)
class NameColumn(ItemTableColumn):
def render_title(self, session, data):
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-17 15:25:14 UTC (rev 2820)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-17 16:01:39 UTC (rev 2821)
@@ -1118,7 +1118,7 @@
got_fn = self.got_fn(session)
elem_id = self.elem_id(session)
- return script % (get_fn, url, got_fn, elem_id, get_fn)
+ return url and script % (get_fn, url, got_fn, elem_id, get_fn) or ""
def get_url(self, session):
pass
Show replies by date