[rhmessaging-commits] rhmessaging commits: r3713 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Nov 16 15:39:59 EST 2009


Author: eallen
Date: 2009-11-16 15:39:58 -0500 (Mon, 16 Nov 2009)
New Revision: 3713

Modified:
   mgmt/trunk/cumin/python/cumin/model.py
Log:
Fix for https://bugzilla.redhat.com/show_bug.cgi?id=537851. Override get_object_name and CuminProperty class for CuminExchange to output 'Default Exchange' when the name is blank.

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2009-11-16 18:21:53 UTC (rev 3712)
+++ mgmt/trunk/cumin/python/cumin/model.py	2009-11-16 20:39:58 UTC (rev 3713)
@@ -1371,7 +1371,7 @@
         super(CuminExchange, self).__init__(model, "exchange",
                                             Exchange, ExchangeStats)
 
-        prop = CuminProperty(self, "name")
+        prop = self.NameProperty(self, "name")
         prop.title = "Name"
 
         prop = CuminProperty(self, "type")
@@ -1439,13 +1439,21 @@
         return "resource?name=exchange-36.png"
 
     def get_object_title(self, session, object):
-        name = self.get_object_name(object)
+        name = super(CuminExchange, self).get_object_name(object)
 
         if name:
             return super(CuminExchange, self).get_object_title(session, object)
         else:
-            return "Default Exchange"
+            return self.get_object_name(object)
 
+    def get_object_name(self, object):
+        return object.name and object.name or "Default Exchange"
+
+    class NameProperty(CuminProperty):
+        def value(self, session, object):
+            value = getattr(object, self.name, None)
+            return value and value or "Default Exchange"
+            
 class CuminBinding(RemoteClass):
     def __init__(self, model):
         super(CuminBinding, self).__init__(model, "binding",



More information about the rhmessaging-commits mailing list