-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
The middleware doesn't work properly in asgi mode #381
Comments
Thank you for the report. I haven't been able to reproduce the problem because you didn’t provide enough details, but I have a proposed fix in #382. Please can you test it?
Please provide the error message with the stack trace.
Please provide the stack trace.
I see this changed in Python 3.12. Thanks.
The middleware deliberately doesn't use that class, which would make it slower because it uses
Django 4.2.6 doesn’t currently support Python 3.12. The only supported versions are those listed in the release notes page: https://docs.djangoproject.com/en/4.2/releases/4.2/ . The tracking ticket: https://code.djangoproject.com/ticket/34118 . You will likely encounter other incompatibility issues, especially so early into Python 3.12's release cycle. |
I also made an optimization PR on Django, following investigation into the changes to |
Python Version
3.12.0
Django Version
4.2.6
Package Version
1.17.0
Description
When you turn on asgi mode in Django using
daphne
we get error message in middleware chain. This happens because Django uses the following functionasgi.sync.markcoroutinefunction
to mark whether a coroutine is present or not. In heredjango-htmx/src/django_htmx/middleware.py
Line 33 in 2354992
_is_coroutine
there should be an attribute_is_coroutine_marker
. To fix this, you can use themarkcoroutinefunction
or theMiddlewareMixin
class to support backwards compatibility.Example of configuration to reproduce behavior
After that, you get next error:
object HttpResponse can't be used in 'await' expression
The text was updated successfully, but these errors were encountered: