Author: justi9
Date: 2007-10-16 11:39:36 -0400 (Tue, 16 Oct 2007)
New Revision: 1086
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/realm.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/virtualhost.py
Log:
Use sorted_by instead of custom sort functions everywhere.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -4,6 +4,7 @@
from virtualhost import *
from server import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -12,7 +13,7 @@
return "Clusters (%i)" % len(model.get_clusters())
def get_items(self, session, model):
- return sorted(model.get_clusters(), cmp, lambda x: x.name)
+ return sorted_by(model.get_clusters())
def render_item_link(self, session, cluster):
branch = session.branch()
@@ -25,7 +26,7 @@
return "Servers (%i)" % len(cluster.server_items())
def get_items(self, session, cluster):
- return sorted(cluster.server_items(), cmp, lambda x: x.name)
+ return sorted_by(cluster.server_items())
def render_item_link(self, session, server):
branch = session.branch()
@@ -98,7 +99,7 @@
return "Functional Hosts (%i)" % len(cluster.virtual_host_items())
def get_items(self, session, cluster):
- return sorted(cluster.virtual_host_items(), cmp, lambda x: x.name)
+ return sorted_by(cluster.virtual_host_items())
class ConfigTab(Widget):
def render_title(self, session, cluster):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -5,6 +5,7 @@
from model import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -24,7 +25,7 @@
self.set_parameter(param)
def get_items(self, session, vhost):
- return sorted(vhost.exchange_items(), cmp, lambda x: x.name)
+ return sorted_by(vhost.exchange_items())
def render_item_value(self, session, exchange):
return exchange.id
@@ -40,7 +41,7 @@
return "Exchanges (%s)" % len(vhost.exchange_items())
def get_items(self, session, vhost):
- return sorted(vhost.exchange_items(), cmp, lambda x: x.name)
+ return sorted_by(vhost.exchange_items())
def render_item_link(self, session, exchange):
branch = session.branch()
@@ -107,8 +108,7 @@
return "Bindings (%i)" % len(exchange.binding_items())
def get_items(self, session, exchange):
- return sorted(exchange.binding_items(), cmp,
- lambda x: x.get_queue().name)
+ return sorted_by(exchange.binding_items(), "id")
def render_item_href(self, session, binding):
branch = session.branch()
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -6,6 +6,7 @@
from model import *
from widgets import *
from exchange import ExchangeInputSet
+from util import *
strings = StringCatalog(__file__)
@@ -32,7 +33,7 @@
return "Queues (%s)" % len(vhost.queue_items())
def get_items(self, session, vhost):
- return sorted(vhost.queue_items(), cmp, lambda x: x.name)
+ return sorted_by(vhost.queue_items())
def render_item_link(self, session, queue):
branch = session.branch()
@@ -137,8 +138,7 @@
return "Bindings (%i)" % len(queue.binding_items())
def get_items(self, session, queue):
- return sorted(queue.binding_items(), cmp,
- lambda x: x.get_exchange().name)
+ return sorted_by(queue.binding_items(), "id")
def render_item_href(self, session, binding):
branch = session.branch()
@@ -331,8 +331,7 @@
class Exchanges(ExchangeInputSet):
def get_items(self, session, queue):
- return sorted(queue.virtual_host.exchange_items(), cmp,
- lambda x: x.name)
+ return sorted_by(queue.virtual_host.exchange_items())
class QueueBindingRemove(CuminConfirmForm):
def process_confirm(self, session, binding):
Modified: mgmt/cumin/python/cumin/realm.py
===================================================================
--- mgmt/cumin/python/cumin/realm.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/realm.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -5,6 +5,7 @@
from model import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -13,7 +14,7 @@
return "Realms (%i)" % len(vhost.realm_items())
def get_items(self, session, vhost):
- return sorted(vhost.realm_items())
+ return sorted_by(vhost.realm_items())
def render_item_name(self, session, realm):
return realm.name
@@ -34,7 +35,7 @@
self.set_parameter(param)
def get_items(self, session, vhost):
- return sorted(vhost.realm_items())
+ return sorted_by(vhost.realm_items())
# XXX just parked here
def do_process(self, session, queue):
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -284,7 +284,7 @@
self.group_tmpl = Template(self, "group_html")
def get_items(self, session, model):
- return sorted(model.get_server_group_types(), cmp, lambda x: x.name)
+ return sorted_by(model.get_server_group_types())
def render_types(self, session, model):
writer = Writer()
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-16 15:34:43 UTC (rev 1085)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-16 15:39:36 UTC (rev 1086)
@@ -5,6 +5,7 @@
from realm import *
from exchange import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -13,7 +14,7 @@
return "Functional Hosts (%i)" % len(model.get_virtual_hosts())
def get_items(self, session, model):
- return sorted(model.get_virtual_hosts(), cmp, lambda x: x.name)
+ return sorted_by(model.get_virtual_hosts())
def render_item_link(self, session, vhost):
branch = session.branch()