Really pick the last version on Pypi for new version checking.

We were only sorting version string lexicographically and it would have break when
we reach version 0.10.N or 0.N.10
This commit is contained in:
Valentin Samir 2016-09-06 12:02:43 +02:00
parent 990f00fe3c
commit 868a06ea3f
2 changed files with 9 additions and 4 deletions

View file

@ -13,6 +13,12 @@ Added
-----
* Add autofocus to the username input on the login page
Fixed
-----
* Really pick the last version on Pypi for new version checking.
We were only sorting version string lexicographically and it would have break when
we reach version 0.10.N or 0.N.10
v0.7.2 - 2016-08-31
===================

View file

@ -653,7 +653,8 @@ def check_password(method, password, hashed_password, charset):
def decode_version(version):
"""
decode a version string following version semantic http://semver.org/ input a tuple of int
decode a version string following version semantic http://semver.org/ input a tuple of int.
It will work as long as we do not use pre release versions.
:param unicode version: A dotted version
:return: A tuple a int
@ -683,9 +684,7 @@ def last_version():
try:
req = requests.get(settings.CAS_NEW_VERSION_JSON_URL)
data = json.loads(req.text)
versions = list(data["releases"].keys())
versions.sort()
version = versions[-1]
version = data["info"]["version"]
last_version._cache = (time.time(), version, True)
return version
except (