Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rest_framework/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class URLPathVersioning(BaseVersioning):

def determine_version(self, request, *args, **kwargs):
version = kwargs.get(self.version_param, self.default_version)
if version is None:
version = self.default_version
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be marginally cleaner as:

version = kwargs.get(self.version_param)
if version is None:
    version = self.default_version

Note that we're already checking for "version not in the regex groups", but we're not checking for "version is in the regex groups, but is None".


if not self.is_allowed_version(version):
raise exceptions.NotFound(self.invalid_version_message)
return version
Expand Down