diff --git a/frappe/desk/search.py b/frappe/desk/search.py index c4a94074ba..b820fabd6d 100644 --- a/frappe/desk/search.py +++ b/frappe/desk/search.py @@ -284,7 +284,9 @@ def build_for_autosuggest(res: list[tuple], doctype: str) -> list[dict]: item = list(item) label = item[1] # use title as label item[1] = item[0] # show name in description instead of title - del item[2] # remove redundant title ("label") value + if len(item) >= 3 and item[2] == label: + # remove redundant title ("label") value + del item[2] results.append({"value": item[0], "label": label, "description": to_string(item[1:])}) else: results.extend({"value": item[0], "description": to_string(item[1:])} for item in res) diff --git a/frappe/public/scss/website/index.scss b/frappe/public/scss/website/index.scss index 109bc8cbb4..e54baf0dd0 100644 --- a/frappe/public/scss/website/index.scss +++ b/frappe/public/scss/website/index.scss @@ -1,6 +1,7 @@ @import '../common/quill'; @import 'variables'; @import '~bootstrap/scss/bootstrap'; +@import '~cropperjs/dist/cropper.min'; @import "../common/mixins"; @import "../common/global"; @import "../common/icons"; diff --git a/frappe/tests/test_translate.py b/frappe/tests/test_translate.py index e546516ade..a5e2876241 100644 --- a/frappe/tests/test_translate.py +++ b/frappe/tests/test_translate.py @@ -112,6 +112,14 @@ class TestTranslate(FrappeTestCase): self.assertIn(return_val, [second_lang, get_parent_language(second_lang)]) + def test_global_translations(self): + """ """ + site = frappe.local.site + frappe.destroy() + _("this shouldn't break") + frappe.init(site=site) + frappe.connect() + def test_guest_request_language_resolution_with_request_header(self): """Test for frappe.translate.get_language diff --git a/frappe/translate.py b/frappe/translate.py index 3f4a5f0c95..339ab6cb05 100644 --- a/frappe/translate.py +++ b/frappe/translate.py @@ -291,7 +291,12 @@ def get_all_translations(lang: str) -> dict[str, str]: return all_translations - return frappe.cache().hget(MERGED_TRANSLATION_KEY, lang, generator=_merge_translations) + try: + return frappe.cache().hget(MERGED_TRANSLATION_KEY, lang, generator=_merge_translations) + except Exception: + # People mistakenly call translation function on global variables + # where locals are not initalized, translations dont make much sense there + return {} def get_translations_from_apps(lang, apps=None): diff --git a/pyproject.toml b/pyproject.toml index a552474a3f..dd51deed3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "cairocffi==1.2.0", "chardet~=4.0.0", "croniter~=1.3.5", - "cryptography~=37.0.2", + "cryptography~=38.0.3", "email-reply-parser~=0.5.12", "git-url-parse~=1.2.2", "gunicorn~=20.1.0",