diff options
author | Andy Grover <agrover@redhat.com> | 2014-09-22 09:28:16 -0700 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-09-22 09:28:16 -0700 |
commit | df01b55a773770ef5cd09a52181ee6b35acf69b0 (patch) | |
tree | 22555fc38653a359cf2845d213c0e8b4bff6ec07 | |
parent | 485c251432cca816c387e9f00412fe4737379b13 (diff) | |
download | configshell-fb-df01b55a773770ef5cd09a52181ee6b35acf69b0.tar.gz |
Fix exception on sorting
A node named "foo4" will match the regexp in sorting_keys and will sort by
("foo", 4). A node named "foo" will not match and will sort by
("foo", None).
This is incorrect because None is not orderable with integers. In the
second case, having the second element in the tuple be 0 does the
right thing.
Fixes #14
Reported-by: Arthur Lutz
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | configshell/node.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/configshell/node.py b/configshell/node.py index 27272d1..a773cb7 100644 --- a/configshell/node.py +++ b/configshell/node.py @@ -804,7 +804,7 @@ class ConfigNode(object): if m: return (m.group(1), int(m.group(2))) else: - return (str(s), None) + return (str(s), 0) # Sort ending numbers numerically, so we get e.g. "lun1, lun2, lun10" # instead of "lun1, lun10, lun2". |