Author: eallen
Date: 2011-01-21 17:26:11 +0000 (Fri, 21 Jan 2011)
New Revision: 4477
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/negotiator.strings
trunk/cumin/python/cumin/model.py
Log:
Candidate fix for BZ 671388. Change exception handling to be compatible with python 2.4
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-01-19 19:24:30 UTC (rev 4476)
+++ trunk/cumin/python/cumin/grid/job.py 2011-01-21 17:26:11 UTC (rev 4477)
@@ -300,7 +300,9 @@
qmf_response = self.qmf_response.get(session)
if qmf_response.exception:
writer = Writer()
- msg = "The data is not available at this time. <br/>%s" %
str(qmf_response.exception.message)
+ e = qmf_response.exception
+ m = len(e.args) > 0 and e.args[0] or ""
+ msg = "The data is not available at this time. <br/>%s" % m
self.error_tmpl.render(writer, session, msg)
return writer.to_string()
@@ -556,7 +558,7 @@
# check for qmf error
_, error = self.parent.do_get_items(session)
if error:
- msg = error.message
+ msg = len(error.args) > 0 and error.args[0] or ""
if not msg:
# probably a timeout exception
msg = "Unable to get Job information at this time"
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-01-19 19:24:30 UTC (rev 4476)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-01-21 17:26:11 UTC (rev 4477)
@@ -100,6 +100,8 @@
def __init__(self, app, name, negotiator, frame):
super(NegotiatorOverview, self).__init__(app, name)
+ self.negotiator = negotiator
+
self.update_enabled = True
#self.defer_enabled = True
@@ -147,10 +149,13 @@
except AssertionError:
msg = "Missing negotiator"
except Exception, e:
- msg = e.message
+ msg = len(e.args) > 0 and e.args[0] or ""
if msg == "Loading":
tmpl = self.loading_tmpl
else:
+ neg = self.negotiator.get(session)
+ neg_name = neg and " for negotiator %s" % neg.Name or
""
+ msg = "%s%s" % (e, neg_name)
log.exception(e)
else:
return super(NegotiatorOverview, self).do_render(session)
@@ -267,7 +272,8 @@
except TypeError:
if isinstance(value, Exception):
content = "<span
class='QuotaError'>error</span>"
- return fmt_link("#", content, "", "",
value.message)
+ val = len(value.args) > 0 and value.args[0] or ""
+ return fmt_link("#", content, "", "",
val)
href = self.task.get_href(session)
content = "%s%%" % str(round(fval * 100.0, 2))
@@ -303,11 +309,12 @@
if not groups:
if (not results.status) and (not results.exception):
- raise QmfException("Loading")
- #results.exception = QmfException("Request timed out. Please
refresh the page to try again.")
+ raise Exception("Loading")
if results.exception:
raise results.exception
else:
+ if not groups:
+ raise Exception(results.status)
try:
groups = self.split_group_names(groups)
except Exception, e:
Modified: trunk/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.strings 2011-01-19 19:24:30 UTC (rev 4476)
+++ trunk/cumin/python/cumin/grid/negotiator.strings 2011-01-21 17:26:11 UTC (rev 4477)
@@ -53,7 +53,7 @@
<![CDATA[
(function() {
window.addEvent("domready", function () {
- setTimeout( function () { window.location.reload(); }, 2000 );
+ setTimeout( function () { window.location.reload(); }, 5000 );
});
}())
]]>
Modified: trunk/cumin/python/cumin/model.py
===================================================================
--- trunk/cumin/python/cumin/model.py 2011-01-19 19:24:30 UTC (rev 4476)
+++ trunk/cumin/python/cumin/model.py 2011-01-21 17:26:11 UTC (rev 4477)
@@ -906,13 +906,6 @@
return "%s%s" % (conf, rect)
-class QmfException(Exception):
- def __init__(self, value):
- self.message = value
-
- def __str__(self):
- return repr(self.message)
-
class QmfCall(object):
def __init__(self, app, default=None, timeout=5):
self.app = app
@@ -929,7 +922,7 @@
self.data = data
self.got_data = True
else:
- self.error = QmfException(status)
+ self.error = Exception(status)
msg = "QMF call returned with status of %s" % str(status)
log.error(msg)
return completion
@@ -951,7 +944,7 @@
results = self.do_wait()
if not results.got_data and not results.error:
- results.error = QmfException("Request timed out")
+ results.error = Exception("Request timed out")
msg = "QMF call %s timed out" % method_name
log.error(msg)