fixes in index page logic

This commit is contained in:
Anand Doshi 2012-07-11 18:56:13 +05:30
parent 8c7e76ba44
commit 51fc20be5b

View File

@ -81,14 +81,14 @@ def load_into_web_cache(page_name, template, doc_type, doc_name):
return html return html
def prepare_args(page_name, doc_type, doc_name, with_outer_env=1): def prepare_args(page_name, doc_type, doc_name, with_outer_env=1):
if page_name == 'index':
page_name, doc_type, doc_name = get_index_page()
if page_name in ['404', 'blog', 'products', 'login-page']: if page_name in ['404', 'blog', 'products', 'login-page']:
args = { args = {
'name': page_name, 'name': page_name,
} }
else: else:
if page_name == 'index':
page_name, doc_type, doc_name = get_index_page()
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
obj = get_obj(doc_type, doc_name) obj = get_obj(doc_type, doc_name)
if hasattr(obj, 'prepare_template_args'): if hasattr(obj, 'prepare_template_args'):
@ -129,6 +129,8 @@ def get_index_page():
doc_type = 'Web Page' doc_type = 'Web Page'
doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page') doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')
page_name = webnotes.conn.get_value(doc_type, doc_name, 'page_name') page_name = webnotes.conn.get_value(doc_type, doc_name, 'page_name')
if not page_name:
page_name = 'login-page'
return page_name, doc_type, doc_name return page_name, doc_type, doc_name
# cache management # cache management