diff --git a/frappe/templates/base.html b/frappe/templates/base.html index aaed0035b9..dc87ab72dd 100644 --- a/frappe/templates/base.html +++ b/frappe/templates/base.html @@ -30,11 +30,11 @@ {%- if theme.name != 'Standard' -%} {%- else -%} - + {%- endif -%} {%- for link in web_include_css %} - + {%- endfor -%} {%- endblock -%} @@ -94,12 +94,12 @@ {% block base_scripts %} - + {% endblock %} {%- for link in web_include_js %} - + {%- endfor -%} {%- block script %} diff --git a/frappe/utils/__init__.py b/frappe/utils/__init__.py index d3bf1dd10c..c209ee13c9 100644 --- a/frappe/utils/__init__.py +++ b/frappe/utils/__init__.py @@ -721,3 +721,11 @@ def get_file_size(path, format=False): num /= 1024 return "{0:.1f}{1}{2}".format(num, 'Yi', suffix) + +def get_build_version(): + try: + return str(os.path.getmtime(os.path.join(frappe.local.sites_path, '.build'))) + except OSError: + # .build can sometimes not exist + # this is not a major problem so send fallback + return frappe.utils.random_string(8) diff --git a/frappe/website/router.py b/frappe/website/router.py index 22d186790b..5244c57ba8 100644 --- a/frappe/website/router.py +++ b/frappe/website/router.py @@ -275,8 +275,7 @@ def get_page_info(path, app, start, basepath=None, app_path=None, fname=None): # extract properties from controller attributes load_properties_from_controller(page_info) - # if not page_info.title: - # print('no-title-for', page_info.route) + page_info.build_version = frappe.utils.get_build_version() return page_info diff --git a/frappe/www/desk.py b/frappe/www/desk.py index c6bce850a5..e5c3c6af5c 100644 --- a/frappe/www/desk.py +++ b/frappe/www/desk.py @@ -36,7 +36,7 @@ def get_context(context): context.update({ "no_cache": 1, - "build_version": get_build_version(), + "build_version": frappe.utils.get_build_version(), "include_js": hooks["app_include_js"], "include_css": hooks["app_include_css"], "sounds": hooks["sounds"], @@ -82,11 +82,3 @@ def get_desk_assets(build_version): "boot": data["boot"], "assets": assets } - -def get_build_version(): - try: - return str(os.path.getmtime(os.path.join(frappe.local.sites_path, '.build'))) - except OSError: - # .build can sometimes not exist - # this is not a major problem so send fallback - return frappe.utils.random_string(8)