Answer the question
In order to leave comments, you need to log in
Do I need to handle exceptions if the data arrives from the session?
I have the following code in the view:
def test_func(self):
folder_pk = self.request.session['folder_pk']
user = Folder.objects.get(pk=folder_pk).user
return self.request.user == user
user = Folder.objects.get(pk=folder_pk).user
application may crash on the line. Is it necessary to handle such a situation, or if the old man has access to the session, it doesn’t matter if the application crashes or not, and you need to solve the problem from the other side?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question