@@ -20,6 +20,11 @@ def render(page_name): | |||||
html = render_page(page_name or "index") | html = render_page(page_name or "index") | ||||
except PageNotFoundError: | except PageNotFoundError: | ||||
html = render_page("404") | html = render_page("404") | ||||
except webnotes.DoesNotExistError: | |||||
if page_name=="index": | |||||
html = render_page("login") | |||||
else: | |||||
html = render_page("404") | |||||
except Exception: | except Exception: | ||||
html = render_page("error") | html = render_page("error") | ||||
@@ -218,9 +223,9 @@ class WebsiteGenerator(object): | |||||
def on_update(self, page_name=None): | def on_update(self, page_name=None): | ||||
self.setup_generator() | self.setup_generator() | ||||
if self._website_config.condition_field: | if self._website_config.condition_field: | ||||
if not self.doc.fields[self._website_config.condition_field]: | |||||
if not self.doc.fields.get(self._website_config.condition_field): | |||||
# condition field failed, return | # condition field failed, return | ||||
remove_page(self.doc.fields[self._website_config.page_name_field]) | |||||
remove_page(self.doc.fields.get(self._website_config.page_name_field)) | |||||
return | return | ||||
if not page_name: | if not page_name: | ||||
@@ -10,7 +10,6 @@ class DocType: | |||||
self.doc, self.doclist = d, dl | self.doc, self.doclist = d, dl | ||||
def validate(self): | def validate(self): | ||||
self.set_home_page() | |||||
self.validate_top_bar_items() | self.validate_top_bar_items() | ||||
self.validate_footer_items() | self.validate_footer_items() | ||||
@@ -59,6 +58,8 @@ class DocType: | |||||
def on_update(self): | def on_update(self): | ||||
# make js and css | # make js and css | ||||
# clear web cache (for menus!) | # clear web cache (for menus!) | ||||
self.set_home_page() | |||||
from webnotes.webutils import clear_cache | from webnotes.webutils import clear_cache | ||||
clear_cache() | clear_cache() | ||||
@@ -19,4 +19,3 @@ def add_to_sitemap(options): | |||||
doc.name = doc.page_name | doc.name = doc.page_name | ||||
doc.website_sitemap_config = options.link_name | doc.website_sitemap_config = options.link_name | ||||
doc.insert() | doc.insert() | ||||
webnotes.conn.commit() |
@@ -34,7 +34,6 @@ import os, time | |||||
def rebuild_website_sitemap_config(): | def rebuild_website_sitemap_config(): | ||||
webnotes.conn.sql("""delete from `tabWebsite Sitemap Config`""") | webnotes.conn.sql("""delete from `tabWebsite Sitemap Config`""") | ||||
webnotes.conn.sql("""delete from `tabWebsite Sitemap`""") | webnotes.conn.sql("""delete from `tabWebsite Sitemap`""") | ||||
webnotes.conn.commit() | |||||
build_website_sitemap_config() | build_website_sitemap_config() | ||||
def build_website_sitemap_config(): | def build_website_sitemap_config(): | ||||
@@ -67,7 +66,9 @@ def build_website_sitemap_config(): | |||||
for name in existing_configs: | for name in existing_configs: | ||||
webnotes.delete_doc("Website Sitemap Config", name) | webnotes.delete_doc("Website Sitemap Config", name) | ||||
webnotes.conn.commit() | |||||
def add_website_sitemap_config(page_or_generator, path, fname, existing_configs): | def add_website_sitemap_config(page_or_generator, path, fname, existing_configs): | ||||
basepath = webnotes.utils.get_base_path() | basepath = webnotes.utils.get_base_path() | ||||
template_path = os.path.relpath(os.path.join(path, fname), basepath) | template_path = os.path.relpath(os.path.join(path, fname), basepath) | ||||
@@ -105,6 +106,5 @@ def add_website_sitemap_config(page_or_generator, path, fname, existing_configs) | |||||
wsc.condition_field = getattr(module, "condition_field", None) | wsc.condition_field = getattr(module, "condition_field", None) | ||||
webnotes.bean(wsc).insert() | webnotes.bean(wsc).insert() | ||||
webnotes.conn.commit() | |||||
return name | return name |