mirror of https://github.com/django/django.git
Fixed #24562 -- Renamed get_major_version() to get_main_version()
This reflects the actual behavior of the method.
This commit is contained in:
parent
e8e4f978dd
commit
ad53213066
|
@ -12,11 +12,11 @@ def get_version(version=None):
|
||||||
version = get_complete_version(version)
|
version = get_complete_version(version)
|
||||||
|
|
||||||
# Now build the two parts of the version number:
|
# Now build the two parts of the version number:
|
||||||
# major = X.Y[.Z]
|
# main = X.Y[.Z]
|
||||||
# sub = .devN - for pre-alpha releases
|
# sub = .devN - for pre-alpha releases
|
||||||
# | {a|b|c}N - for alpha, beta and rc releases
|
# | {a|b|c}N - for alpha, beta and rc releases
|
||||||
|
|
||||||
major = get_major_version(version)
|
main = get_main_version(version)
|
||||||
|
|
||||||
sub = ''
|
sub = ''
|
||||||
if version[3] == 'alpha' and version[4] == 0:
|
if version[3] == 'alpha' and version[4] == 0:
|
||||||
|
@ -28,15 +28,14 @@ def get_version(version=None):
|
||||||
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
|
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
|
||||||
sub = mapping[version[3]] + str(version[4])
|
sub = mapping[version[3]] + str(version[4])
|
||||||
|
|
||||||
return str(major + sub)
|
return str(main + sub)
|
||||||
|
|
||||||
|
|
||||||
def get_major_version(version=None):
|
def get_main_version(version=None):
|
||||||
"Returns major version from VERSION."
|
"Returns main version (X.Y[.Z]) from VERSION."
|
||||||
version = get_complete_version(version)
|
version = get_complete_version(version)
|
||||||
parts = 2 if version[2] == 0 else 3
|
parts = 2 if version[2] == 0 else 3
|
||||||
major = '.'.join(str(x) for x in version[:parts])
|
return '.'.join(str(x) for x in version[:parts])
|
||||||
return major
|
|
||||||
|
|
||||||
|
|
||||||
def get_complete_version(version=None):
|
def get_complete_version(version=None):
|
||||||
|
|
Loading…
Reference in New Issue