##// 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 21 import logging
22 22 import urllib2
23 from packaging import version
23 from packaging.version import Version
24 24
25 25 import rhodecode
26 26 from rhodecode.lib.ext_json import json
@@ -66,6 +66,18 b' class UpdateModel(BaseModel):'
66 66 return obj.app_settings_value
67 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 76 def is_outdated(self, cur_version, latest_version=None):
70 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