Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does this piece of code work? #91

Open
simon-lund opened this issue Dec 29, 2022 · 2 comments
Open

Why does this piece of code work? #91

simon-lund opened this issue Dec 29, 2022 · 2 comments

Comments

@simon-lund
Copy link

if not req[self.session_name]:
await self._delete_key(key)
if req[self.session_name].modified:
self._delete_cookie(request, response)
return

Hello,

I was reading your code and stumbled upon the linked code lines.

There I don't understand why line 167 doesn't throw an error.
Because if if not req[self.session_name] evaluates to True how can there be a modified field?

Best
Simon

@Zerogoki00
Copy link

It checks the value of req[self.session_name]'s modified field. learn python...

@simon-lund
Copy link
Author

No reason to be toxic. I know Python very well.

I just don't make sense to me to access req[self.session_name].modified when not req[self.session_name] == True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants