Skip to content

Commit

Permalink
gwsumm.tabs: use str in all tab sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmmacleod committed Mar 19, 2019
1 parent d3491eb commit 458c552
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions gwsumm/tabs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,18 +1134,19 @@ def get_hierarchy(self):

@staticmethod
def _sortkey(tab):
# NOTE: we need all return values to be strings for
# the sorting to actually work
if 'Home' in tab.shortname:
return 1
return '1'
if tab.shortname == 'Summary' and tab.parent is None:
return 2
elif tab.shortname == 'Summary':
return 3
elif 'ODC' in tab.shortname:
return 4
elif tab.shortname.islower():
return '2'
if tab.shortname == 'Summary':
return '3'
if 'ODC' in tab.shortname:
return '4'
if tab.shortname.islower():
return tab.shortname.upper()
else:
return tab.shortname.lower()
return tab.shortname.lower()

def sort(self, key=None, reverse=False):
"""Sort this `TabList` in place
Expand Down

0 comments on commit 458c552

Please sign in to comment.