diff options
author | zsloan | 2021-10-18 18:30:55 +0000 |
---|---|---|
committer | zsloan | 2021-10-18 18:30:55 +0000 |
commit | 7f241d1205eefe5bec871ef2d5b99168e0e136d7 (patch) | |
tree | b55e871cce674922ff80dc9e218300d5e900318c | |
parent | 789f91513a551dfe65133a2ae6191e6d98cbfcf2 (diff) | |
download | genenetwork2-7f241d1205eefe5bec871ef2d5b99168e0e136d7.tar.gz |
Fixed the way group code was used when setting phenotype trait display name + prevent encoding error with try/except
-rw-r--r-- | wqflask/wqflask/search_results.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 5db469c1..61970e7e 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -122,8 +122,8 @@ class SearchResultPage: trait_dict['display_name'] = result[0] if self.dataset.type == "Publish": - if self.dataset.group.code: - trait_dict['display_name'] = self.dataset.group.code + "_" + str(result[0]) + if result[10]: + trait_dict['display_name'] = str(result[10]) + "_" + str(result[0]) trait_dict['dataset'] = self.dataset.name trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait_dict['name'], trait_dict['dataset'])) @@ -186,7 +186,11 @@ class SearchResultPage: # Convert any bytes in dict to a normal utf-8 string for key in trait_dict.keys(): if isinstance(trait_dict[key], bytes): - trait_dict[key] = trait_dict[key].decode('utf-8') + try: + trait_dict[key] = trait_dict[key].decode('utf-8') + except UnicodeDecodeError: + trait_dict[key] = trait_dict[key].decode('latin-1') + trait_list.append(trait_dict) if self.results: |