diff --git a/erpnext/patches/june_2012/cms2.py b/erpnext/patches/june_2012/cms2.py index c536ecbc418..cf494c01863 100644 --- a/erpnext/patches/june_2012/cms2.py +++ b/erpnext/patches/june_2012/cms2.py @@ -41,7 +41,7 @@ def cleanup(): try: webnotes.model.delete_doc('Page', page) except Exception, e: - webnotes.modules.patch_handler.log(str(e)) + webnotes.modules.patch_handler.log(unicode(e)) import os import conf @@ -74,7 +74,7 @@ def save_pages(): try: DocList(dt, result['name'].encode('utf-8')).save() except Exception, e: - webnotes.modules.patch_handler.log(str(e)) + webnotes.modules.patch_handler.log(unicode(e)) def save_website_settings(): from webnotes.model.code import get_obj diff --git a/erpnext/website/web_cache.py b/erpnext/website/web_cache.py index 8da38e5a144..893f7f2d2a4 100644 --- a/erpnext/website/web_cache.py +++ b/erpnext/website/web_cache.py @@ -225,6 +225,8 @@ def refresh_cache(build=None): # webnotes.conn.sql("delete from `tabWeb Cache`") + clear_cache(None) + query_map = { 'Web Page': """select page_name, name from `tabWeb Page` where docstatus=0""", 'Blog': """\ @@ -236,12 +238,11 @@ def refresh_cache(build=None): } for dt in query_map: - for result in webnotes.conn.sql(query_map[dt], as_dict=1): - create_cache(result['page_name'], dt, result['name']) - clear_cache(result['page_name'], dt, result['name']) - if build and dt in build: load_into_cache(result['page_name']) + if build and dt in build: + for result in webnotes.conn.sql(query_map[dt], as_dict=1): + create_cache(result['page_name'], dt, result['name']) + load_into_cache(result['page_name']) for page_name in get_predefined_pages(): create_cache(page_name, None, None) - clear_cache(page_name, None, None) if build: load_into_cache(page_name) \ No newline at end of file