diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e0b0c48..5d15330 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 =================== diff --git a/cas_server/utils.py b/cas_server/utils.py index 8817b22..78fde92 100644 --- a/cas_server/utils.py +++ b/cas_server/utils.py @@ -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 (