From d53c4dce58301c288dcdbc31d8dd1e47709b7499 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 25 Mar 2015 10:01:44 -0400 Subject: [PATCH] Natural sort of group names when collection queried Keeping with the theme of natural sort, apply it to '/nodegroups/' requests. --- confluent_server/confluent/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index ea1a7fcd..88f549da 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -317,7 +317,12 @@ def handle_nodegroup_request(configmanager, inputdata, if operation == "create": inputdata = msg.InputAttributes(pathcomponents, inputdata) create_group(inputdata.attribs, configmanager) - return iterate_collections(configmanager.get_groups()) + allgroups = list(configmanager.get_groups()) + try: + allgroups.sort(key=noderange.humanify_nodename) + except TypeError: + allgroups.sort() + return iterate_collections(allgroups) elif len(pathcomponents) == 2: iscollection = True else: