##// END OF EJS Templates
update: sanitize version, and check for version parsing exc
marcink -
r2434:ee3535c6 default
parent child Browse files
Show More
@@ -20,7 +20,7 b''
20
20
21 import logging
21 import logging
22 import urllib2
22 import urllib2
23 from packaging import version
23 from packaging.version import Version
24
24
25 import rhodecode
25 import rhodecode
26 from rhodecode.lib.ext_json import json
26 from rhodecode.lib.ext_json import json
@@ -66,6 +66,18 b' class UpdateModel(BaseModel):'
66 return obj.app_settings_value
66 return obj.app_settings_value
67 return '0.0.0'
67 return '0.0.0'
68
68
69 def _sanitize_version(self, version):
70 """
71 Cleanup our custom ver.
72 e.g 4.11.0_20171204_204825_CE_default_EE_default to 4.11.0
73 """
74 return version.split('_')[0]
75
69 def is_outdated(self, cur_version, latest_version=None):
76 def is_outdated(self, cur_version, latest_version=None):
70 latest_version = latest_version or self.get_stored_version()
77 latest_version = latest_version or self.get_stored_version()
71 return version.Version(latest_version) > version.Version(cur_version)
78 try:
79 cur_version = self._sanitize_version(cur_version)
80 return Version(latest_version) > Version(cur_version)
81 except Exception:
82 # could be invalid version, etc
83 return False
General Comments 0
You need to be logged in to leave comments. Login now