klen/muffin-session

current user

Closed this issue · 1 comments

Is it safe to use muffin.local to store the current user?
I look for a way to get current user and use it in a jinja2 context_processor.
In cookiecutter-muffin I created middleware_current_user to store the current user in muffin.local and use this information in current_user_context. If this is ok, I can open a pull request with this features in muffin-session and muffin-jinja2

klen commented

Unfortunately, It's not safe. For most cases — yes. But you need to know about exceptions (asyncio.wait, asyncio.wait_for). I'll write about later.