Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
chore: raise PermissionDenied errors from None
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Apr 17, 2024
1 parent f9d24a2 commit 19df4be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions timed/employment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_queryset(self):
)

return queryset.filter(Q(reports__in=visible_reports) | Q(id=user.id))
except models.Employment.DoesNotExist as exc:
except models.Employment.DoesNotExist:
if CustomerAssignee.objects.filter(user=user, is_customer=True).exists():
assigned_tasks = Task.objects.filter(
Q(
Expand All @@ -93,7 +93,7 @@ def get_queryset(self):
)
return queryset.filter(Q(reports__in=visible_reports) | Q(id=user.id))
msg = "User has no employment"
raise exceptions.PermissionDenied(msg) from exc
raise exceptions.PermissionDenied(msg) from None
else:
return queryset

Expand Down
4 changes: 2 additions & 2 deletions timed/tracking/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get_queryset(self):
)
)
return queryset.filter(Q(task__in=assigned_tasks) | Q(user=user))
except Employment.DoesNotExist as exc:
except Employment.DoesNotExist:
if CustomerAssignee.objects.filter(user=user, is_customer=True).exists():
return queryset.filter(
Q(
Expand All @@ -159,7 +159,7 @@ def get_queryset(self):
)
)
msg = "User has no employment and isn't a customer!"
raise exceptions.PermissionDenied(msg) from exc
raise exceptions.PermissionDenied(msg) from None

def update(self, request, *args, **kwargs):
"""Override so we can issue emails on update."""
Expand Down

0 comments on commit 19df4be

Please sign in to comment.