From 255d58b3a0f67dec3b46bd8c7589ba224105abdd Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 13 Jul 2012 08:53:07 +0530 Subject: [PATCH] fixes in error logging and refresh cache issues --- erpnext/patches/june_2012/cms2.py | 4 ++-- erpnext/website/web_cache.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/june_2012/cms2.py b/erpnext/patches/june_2012/cms2.py index c536ecbc41..cf494c0186 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 8da38e5a14..893f7f2d2a 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