Skip to content

Clarify APIView.dispatch request lifecycle in docstring#9884

Open
sai09111995 wants to merge 3 commits intoencode:mainfrom
sai09111995:improve-apiview-dispatch-docstring
Open

Clarify APIView.dispatch request lifecycle in docstring#9884
sai09111995 wants to merge 3 commits intoencode:mainfrom
sai09111995:improve-apiview-dispatch-docstring

Conversation

@sai09111995
Copy link

This PR improves the docstring for APIView.dispatch to better document
the request/response lifecycle in Django REST Framework.

The updated docstring explains:

  • Request initialization and wrapping
  • Authentication, permission, and throttling checks
  • Handler method resolution
  • Exception handling
  • Response finalization

No functional changes are introduced.

> — [Reinout van Rees][cite]

REST framework provides an `APIView` class, which subclasses Django's `View` class.
REST framework provides an `APIView` class, which subclasses Django’s base `View` class.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "inherits" ?

"""
`.dispatch()` is pretty much the same as Django's regular dispatch,
but with extra hooks for startup, finalize, and exception handling.
Dispatch the incoming request to the appropriate handler method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good, mentioning the flow is actually a good point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's definitely an improvement

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file were rejected in #9882 please don't submit them again

"""
`.dispatch()` is pretty much the same as Django's regular dispatch,
but with extra hooks for startup, finalize, and exception handling.
Dispatch the incoming request to the appropriate handler method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's definitely an improvement

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

Successfully merging this pull request may close these issues.

4 participants