[Django] #34197: method_decorator does not work with async views

5 views
Skip to first unread message

Django

unread,
Dec 2, 2022, 9:42:48 PM12/2/22
to django-...@googlegroups.com
#34197: method_decorator does not work with async views
------------------------------------------------+------------------------
Reporter: Hugo Osvaldo Barrera | Owner: nobody
Type: Uncategorized | Status: new
Component: Utilities | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
This:

@method_decorator(atomic, name="post")

Doesn't work on an async view:

ValueError: The view idf.sync.views.view didn't return an HttpResponse
object. It returned an unawaited coroutine instead. You may need to add an
'await' into your view.

The same view works without the decorator.

--
Ticket URL: <https://code.djangoproject.com/ticket/34197>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 3, 2022, 8:53:12 AM12/3/22
to django-...@googlegroups.com
#34197: method_decorator does not work with async views
-------------------------------------+-------------------------------------
Reporter: Hugo Osvaldo | Owner: nobody
Barrera |
Type: New feature | Status: closed
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate
* component: Utilities => Database layer (models, ORM)
* type: Uncategorized => New feature


Comment:

I think it's about `@atomic` rather than `@method_decorator`. Duplicate of
#33882.

--
Ticket URL: <https://code.djangoproject.com/ticket/34197#comment:1>

Reply all
Reply to author
Forward
0 new messages