clear cache in website

This commit is contained in:
Rushabh Mehta 2012-12-27 18:57:03 +05:30
parent cd71c308a7
commit 0357f1409c
7 changed files with 40 additions and 9 deletions

View File

@ -32,11 +32,13 @@ class DocType(DocTypeNestedSet):
# webpage updates
from website.utils import update_page_name
page_name = self.doc.name
if webnotes.conn.get_value("Website Settings", None,
if webnotes.conn.get_value("Product Settings", None,
"default_product_category")==self.doc.name:
page_name = "products"
from website.utils import clear_cache
clear_cache()
update_page_name(self.doc, self.doc.name)
update_page_name(self.doc, page_name)
from website.helpers.product import invalidate_cache_for
invalidate_cache_for(self.doc.name)

View File

@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-12-07 15:15:28",
"modified_by": "Administrator",
"modified": "2012-12-27 10:38:02"
"modified": "2012-12-27 18:50:20"
},
{
"in_create": 1,
@ -52,6 +52,7 @@
"reqd": 1
},
{
"read_only": 1,
"doctype": "DocField",
"label": "Page Name",
"fieldname": "page_name",

View File

@ -15,4 +15,8 @@ class DocType:
emp = webnotes.doc("Employee", d.employee)
emp.image = url_for_website(emp.image)
emp_list.append(emp)
self.doclist += emp_list
self.doclist += emp_list
def on_update(self):
from website.utils import clear_cache
clear_cache("about")

View File

@ -14,4 +14,8 @@ class DocType:
else:
self.doc.query_options = ["Sales", "Support", "General"]
if self.doc.address:
self.address = webnotes.model_wrapper("Address", self.doc.address).doc
self.address = webnotes.model_wrapper("Address", self.doc.address).doc
def on_update(self):
from website.utils import clear_cache
clear_cache("about")

View File

@ -5,4 +5,9 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
self.doc, self.doclist = d, dl
def on_update(self):
"""clear web cache"""
from website.utils import clear_cache
clear_cache()

View File

@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-20 14:05:00",
"creation": "2012-12-27 11:46:18",
"modified_by": "Administrator",
"modified": "2012-12-20 15:46:15"
"modified": "2012-12-27 18:51:38"
},
{
"issingle": 1,
@ -38,6 +38,21 @@
"name": "Product Settings",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Help",
"fieldname": "help",
"fieldtype": "HTML",
"options": "<div class=\"alert\">To start adding products on the website, check \"Show in Website\" in <b>Item</b> and <b>Item Group</b></div>"
},
{
"description": "This Item Group represents \"products.html\"",
"doctype": "DocField",
"label": "Default Product Category",
"fieldname": "default_product_category",
"fieldtype": "Link",
"options": "Item Group"
},
{
"description": "Default: \"Product Search\"",
"doctype": "DocField",

View File

@ -46,4 +46,4 @@ class DocType:
def on_update(self):
"""rebuild pages"""
from website.helpers.make_web_include_files import make
make()
make()