mirror of
https://github.com/django/django.git
synced 2024-11-18 07:26:04 +00:00
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)
|
||||
|
||||
# Now build the two parts of the version number:
|
||||
# major = X.Y[.Z]
|
||||
# main = X.Y[.Z]
|
||||
# sub = .devN - for pre-alpha releases
|
||||
# | {a|b|c}N - for alpha, beta and rc releases
|
||||
|
||||
major = get_major_version(version)
|
||||
main = get_main_version(version)
|
||||
|
||||
sub = ''
|
||||
if version[3] == 'alpha' and version[4] == 0:
|
||||
@ -28,15 +28,14 @@ def get_version(version=None):
|
||||
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
|
||||
sub = mapping[version[3]] + str(version[4])
|
||||
|
||||
return str(major + sub)
|
||||
return str(main + sub)
|
||||
|
||||
|
||||
def get_major_version(version=None):
|
||||
"Returns major version from VERSION."
|
||||
def get_main_version(version=None):
|
||||
"Returns main version (X.Y[.Z]) from VERSION."
|
||||
version = get_complete_version(version)
|
||||
parts = 2 if version[2] == 0 else 3
|
||||
major = '.'.join(str(x) for x in version[:parts])
|
||||
return major
|
||||
return '.'.join(str(x) for x in version[:parts])
|
||||
|
||||
|
||||
def get_complete_version(version=None):
|
||||
|
Loading…
Reference in New Issue
Block a user