Skip to content

Commit

Permalink
Merge pull request #390 from uw-it-aca/fix/user-pref
Browse files Browse the repository at this point in the history
fix no app user bug
  • Loading branch information
charlon authored Mar 21, 2024
2 parents 5833059 + 21dda85 commit 76ad9bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion compass/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ def auth_user(request):
def user_preferences(request):
us = UserService()
netid = us.get_user()
return {'user_preferences': get_user_preferences(netid)}
user_prefs = get_user_preferences(netid)
return {'user_preferences': user_prefs if user_prefs else {}}
6 changes: 1 addition & 5 deletions compass/dao/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@ def get_user_preferences(netid):
prefs[pref.component] = {}
prefs[pref.component][pref.key] = pref.value
return prefs
except AppUser.DoesNotExist:
return None
except UserPreference.DoesNotExist:
return None
except Exception:
except (AppUser.DoesNotExist, UserPreference.DoesNotExist, Exception):
return None

0 comments on commit 76ad9bb

Please sign in to comment.