Quellcode durchsuchen

refactor: Move get_build_version to utils.py

version-14
Suraj Shetty vor 4 Jahren
Ursprung
Commit
01312889f8
2 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen
  1. +8
    -0
      frappe/utils/__init__.py
  2. +1
    -9
      frappe/www/desk.py

+ 8
- 0
frappe/utils/__init__.py Datei anzeigen

@@ -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)

+ 1
- 9
frappe/www/desk.py Datei anzeigen

@@ -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)

Laden…
Abbrechen
Speichern