Merge pull request #21718 from barredterra/clear-language-cache
This commit is contained in:
commit
688fa27456
2 changed files with 12 additions and 1 deletions
|
|
@ -16,6 +16,10 @@ class Language(Document):
|
|||
def before_rename(self, old, new, merge=False):
|
||||
validate_with_regex(new, "Name")
|
||||
|
||||
def on_update(self):
|
||||
frappe.cache.delete_value("languages_with_name")
|
||||
frappe.cache.delete_value("languages")
|
||||
|
||||
|
||||
def validate_with_regex(name, label):
|
||||
pattern = re.compile("^[a-zA-Z]+[-_]*[a-zA-Z]+$")
|
||||
|
|
|
|||
|
|
@ -357,7 +357,14 @@ def clear_cache(path=None):
|
|||
:param path: (optional) for the given path"""
|
||||
from frappe.website.router import clear_routing_cache
|
||||
|
||||
for key in ("website_generator_routes", "website_pages", "website_full_index", "sitemap_routes"):
|
||||
for key in (
|
||||
"website_generator_routes",
|
||||
"website_pages",
|
||||
"website_full_index",
|
||||
"sitemap_routes",
|
||||
"languages_with_name",
|
||||
"languages",
|
||||
):
|
||||
frappe.cache.delete_value(key)
|
||||
|
||||
clear_routing_cache()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue