Skip to content

Commit

Permalink
BRANCH 4.8: quick fix for sorting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TACTIC committed Dec 23, 2019
1 parent 2c5cbfe commit f330a53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/pyasm/common/common.py
Expand Up @@ -684,7 +684,11 @@ def sort_dict(dct, reverse=False):
''' sort a dictionary based on its keys,
a list of sorted values is returned '''
keys = list(dct.keys())
keys.sort(reverse=reverse)
try:
keys.sort(reverse=reverse)
except Exception as e:
print("WARNING: sorting error: ", str(e))
pass
return list(map(dct.get, keys))
sort_dict = staticmethod(sort_dict)

Expand Down
3 changes: 2 additions & 1 deletion src/tactic/ui/panel/table_layout_wdg.py
Expand Up @@ -1681,6 +1681,7 @@ def order_sobjects(self, sobjects, group_columns):
elif self.order_element and self.order_element.endswith(' desc'):
reverse = True


sobjects = Common.sort_dict(self.group_dict, reverse=reverse)
for sobject in sobjects:
sub_group_columns = group_columns[1:]
Expand Down Expand Up @@ -2773,7 +2774,7 @@ def handle_groups(self, table, row, sobject):


# break groups by a "/" delimiter
if group_value.find("/"):
if isinstance(group_value, six.string_types) and group_value.find("/"):
parts = group_value.split("/")
if not parts[0].endswith(" "):
group_value = parts[0]
Expand Down

0 comments on commit f330a53

Please sign in to comment.