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 * 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 v0.7.2 - 2016-08-31
=================== ===================

View File

@ -653,7 +653,8 @@ def check_password(method, password, hashed_password, charset):
def decode_version(version): 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 :param unicode version: A dotted version
:return: A tuple a int :return: A tuple a int
@ -683,9 +684,7 @@ def last_version():
try: try:
req = requests.get(settings.CAS_NEW_VERSION_JSON_URL) req = requests.get(settings.CAS_NEW_VERSION_JSON_URL)
data = json.loads(req.text) data = json.loads(req.text)
versions = list(data["releases"].keys()) version = data["info"]["version"]
versions.sort()
version = versions[-1]
last_version._cache = (time.time(), version, True) last_version._cache = (time.time(), version, True)
return version return version
except ( except (