misc: include version hash in static ressources URLs (#31841)
This commit is contained in:
parent
bf2dfb5757
commit
2d72fbb1a1
|
@ -14,6 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import hashlib
|
||||
import time
|
||||
import traceback
|
||||
import sys
|
||||
|
@ -99,9 +100,11 @@ class HTTPResponse(quixote.http_response.HTTPResponse):
|
|||
def get_javascript_for_header(self):
|
||||
s = ''
|
||||
if self.javascript_scripts:
|
||||
from qommon.admin.menu import get_vc_version
|
||||
version_hash = hashlib.md5(str(get_vc_version())).hexdigest()
|
||||
root_url = get_publisher().get_root_url() + get_publisher().qommon_static_dir
|
||||
s += '\n'.join(['<script type="text/javascript" src="%sjs/%s"></script>' % (
|
||||
root_url, str(x)) for x in self.javascript_scripts])
|
||||
s += '\n'.join(['<script type="text/javascript" src="%sjs/%s?%s"></script>' % (
|
||||
root_url, str(x), version_hash) for x in self.javascript_scripts])
|
||||
s += '\n'
|
||||
if self.javascript_code_parts:
|
||||
s += '<script type="text/javascript">'
|
||||
|
@ -118,9 +121,11 @@ class HTTPResponse(quixote.http_response.HTTPResponse):
|
|||
def get_css_includes_for_header(self):
|
||||
if not self.css_includes:
|
||||
return ''
|
||||
from qommon.admin.menu import get_vc_version
|
||||
version_hash = hashlib.md5(str(get_vc_version())).hexdigest()
|
||||
root_url = get_publisher().get_root_url() + get_publisher().qommon_static_dir
|
||||
return '\n'.join(['<link rel="stylesheet" type="text/css" href="%scss/%s" />' % (
|
||||
root_url, x) for x in self.css_includes])
|
||||
return '\n'.join(['<link rel="stylesheet" type="text/css" href="%scss/%s?%s" />' % (
|
||||
root_url, x, version_hash) for x in self.css_includes])
|
||||
|
||||
def add_after_job(self, label, cmd, fire_and_forget = False):
|
||||
if not self.after_jobs:
|
||||
|
|
Loading…
Reference in New Issue