Opened 4 years ago

Closed 4 years ago

#24562 closed Cleanup/optimization (fixed)

django.utils.version.get_major_version() does not return the major version

Reported by: Shai Berger Owned by: Tim Graham
Component: Utilities Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Shai Berger)

django.utils.version.get_major_version() should returns a x.y string, that is what we call a major version. It does that only for the ".0" versions -- It returns "1.8" for 1.8, and "1.8.1" for 1.8.1.

I'm not quite sure about the fix -- django.utils.version.get_major_version() looks like a public interface but it is not documented. Now that the tests have been fixed, its only use in the Django code base is in the same file (from get_version()).

Should we just make it private?

Change History (6)

comment:1 Changed 4 years ago by Baptiste Mispelon

Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by Tim Graham

Has patch: set
Owner: changed from nobody to Tim Graham
Status: newassigned

comment:3 Changed 4 years ago by Shai Berger

Description: modified (diff)
Severity: Release blockerNormal
Summary: Test failure: Pickleabilitydjango.utils.version.get_major_version() does not return the major version

I see that the PR is already merged, so there are no longer test failures and what's left is not a release blocker.

I updated the summary and description to focus on the issues left.

comment:4 Changed 4 years ago by Tim Graham

Has patch: unset

Sorry, you created the ticket after I submitted the PR and I forgot to update the commit message. Anyway, yes, I think we could just revert the addition of the get_major_version() method as it was added in the same commit as the tests that used it (42736ac8e8c31137131714013951249a09e6e7d4).

comment:5 Changed 4 years ago by Tim Graham

Has patch: set
Type: BugCleanup/optimization

Well, it might be useful to leave the method but rename it to reflect its behavior: PR.

comment:6 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In ad532130:

Fixed #24562 -- Renamed get_major_version() to get_main_version()

This reflects the actual behavior of the method.

Note: See TracTickets for help on using tickets.
Back to Top