From c6f6f45e0d12f4a75e1cf80654c9481ec7260dd7 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 9 Sep 2021 07:59:28 +0200 Subject: [PATCH] removed up_to_date checking --- app/scodoc/sco_up_to_date.py | 93 ++---------------------------------- sco_version.py | 2 +- 2 files changed, 5 insertions(+), 90 deletions(-) diff --git a/app/scodoc/sco_up_to_date.py b/app/scodoc/sco_up_to_date.py index cab38a63..cd473f97 100644 --- a/app/scodoc/sco_up_to_date.py +++ b/app/scodoc/sco_up_to_date.py @@ -28,104 +28,19 @@ """ Verification version logiciel vs version "stable" sur serveur N'effectue pas la mise à jour automatiquement, mais permet un affichage d'avertissement. + + Désactivé temporairement pour ScoDoc 9. """ -import datetime -import app.scodoc.sco_utils as scu -from app import log - -# Appel renvoyant la subversion "stable" -# La notion de "stable" est juste là pour éviter d'afficher trop frequemment -# des avertissements de mise à jour: on veut pouvoir inciter à mettre à jour lors de -# correctifs majeurs. - -GET_VER_URL = "http://scodoc.iutv.univ-paris13.fr/scodoc-installmgr/last_stable_version" - - -def get_last_stable_version(): - """request last stable version number from server - (returns string as given by server, empty if failure) - (do not wait server answer more than 3 seconds) - """ - global _LAST_UP_TO_DATE_REQUEST - ans = scu.query_portal( - GET_VER_URL, msg="ScoDoc version server", timeout=3 - ) # sco_utils - if ans: - ans = ans.strip() - _LAST_UP_TO_DATE_REQUEST = datetime.datetime.now() - log( - 'get_last_stable_version: updated at %s, answer="%s"' - % (_LAST_UP_TO_DATE_REQUEST, ans) - ) - return ans - - -_LAST_UP_TO_DATE_REQUEST = None # datetime of last request to server -_UP_TO_DATE = True # cached result (limit requests to 1 per day) -_UP_TO_DATE_MSG = "" +from flask import current_app def is_up_to_date(): """True if up_to_date Returns status, message """ - log("Warning: is_up_to_date not implemented for ScoDoc8") + current_app.logger.debug("Warning: is_up_to_date not implemented for ScoDoc9") return True, "unimplemented" - # global _LAST_UP_TO_DATE_REQUEST, _UP_TO_DATE, _UP_TO_DATE_MSG - # if _LAST_UP_TO_DATE_REQUEST and ( - # datetime.datetime.now() - _LAST_UP_TO_DATE_REQUEST - # ) < datetime.timedelta(1): - # # requete deja effectuee aujourd'hui: - # return _UP_TO_DATE, _UP_TO_DATE_MSG - - # last_stable_ver = get_last_stable_version() - # cur_ver = scu.get_svn_version(scu.SCO_SRC_DIR) # in sco_utils - # cur_ver2 = cur_ver - # cur_ver_num = -1 - # # Convert versions to integers: - # try: - # # cur_ver can be "1234" or "1234M' or '1234:1245M'... - # fs = cur_ver.split(":", 1) - # if len(fs) > 1: - # cur_ver2 = fs[-1] - # m = re.match(r"([0-9]*)", cur_ver2) - # if not m: - # raise ValueError( - # "invalid svn version" - # ) # should never occur, regexp always (maybe empty) match - # cur_ver_num = int(m.group(1)) - # except: - # log('Warning: no numeric subversion ! (cur_ver="%s")' % cur_ver) - # return _UP_TO_DATE, _UP_TO_DATE_MSG # silently ignore misconfiguration ? - # try: - # last_stable_ver_num = int(last_stable_ver) - # except: - # log("Warning: last_stable_version returned by server is invalid !") - # return ( - # _UP_TO_DATE, - # _UP_TO_DATE_MSG, - # ) # should ignore this error (maybe server is unreachable) - # # - # if cur_ver_num < last_stable_ver_num: - # _UP_TO_DATE = False - # _UP_TO_DATE_MSG = "Version %s disponible (version %s installée)" % ( - # last_stable_ver, - # cur_ver_num, - # ) - # log( - # "Warning: ScoDoc installation is not up-to-date, should upgrade\n%s" - # % _UP_TO_DATE_MSG - # ) - # else: - # _UP_TO_DATE = True - # _UP_TO_DATE_MSG = "" - # log( - # "ScoDoc is up-to-date (cur_ver: %s, using %s=%s)" - # % (cur_ver, cur_ver2, cur_ver_num) - # ) - - # return _UP_TO_DATE, _UP_TO_DATE_MSG def html_up_to_date_box(): diff --git a/sco_version.py b/sco_version.py index 7669307f..2e77dbe6 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.0.10" +SCOVERSION = "9.0.11" SCONAME = "ScoDoc"