django-currentuser icon indicating copy to clipboard operation
django-currentuser copied to clipboard

Should we be using asgiref.local.Local if available for import?

Open jacklinke opened this issue 4 years ago • 0 comments

With django now supporting async, should we be trying to import asgiref.local.Local if available, which is a drop-in async replacement for threading.local?

Perhaps replacing:

from threading import local

With:

try:
    from asgiref.local import Local as local
except ImportError:
    from threading import local

Would be happy to make a PR for this, but not sure how to approach the situation where asgiref package is available vs when it is not.

jacklinke avatar May 18 '21 01:05 jacklinke