From c7b485e72435308190aa11f68b3e77e93729c15f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 22 Jun 2012 20:08:30 +0530 Subject: [PATCH] blog - on update - delete cache if not published --- erpnext/website/doctype/blog/blog.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index 0dfecc0a81..0e8acac196 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -29,7 +29,16 @@ class DocType(website.web_page.Page): super(DocType, self).__init__('Blog') self.doc, self.doclist = d, dl + def on_update(self): + super(DocType, self).on_update() + if not webnotes.utils.cint(self.doc.published): + self.delete_web_cache(self.doc.page_name) + def get_html(self): + # this is for double precaution. usually it wont reach this code if not published + if not webnotes.utils.cint(self.doc.published): + raise Exception, "This blog has not been published yet!" + # temp fields from webnotes.utils import global_date_format, get_fullname self.doc.full_name = get_fullname(self.doc.owner)