fix: Raise PageDoesNotExistError instead of DoesNotExistError (#12485)

- to avoid it getting mixed up with Document Not Found error
This commit is contained in:
Suraj Shetty 2021-02-26 12:59:42 +05:30 committed by GitHub
parent 91176153a2
commit 71dd300ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -33,6 +33,9 @@ class PermissionError(Exception):
class DoesNotExistError(ValidationError):
http_status_code = 404
class PageDoesNotExistError(ValidationError):
http_status_code = 404
class NameError(Exception):
http_status_code = 409

View file

@ -47,7 +47,7 @@ def render(path=None, http_status_code=None):
else:
try:
data = render_page_by_language(path)
except frappe.DoesNotExistError:
except frappe.PageDoesNotExistError:
doctype, name = get_doctype_from_path(path)
if doctype and name:
path = "printview"

View file

@ -47,7 +47,7 @@ def get_page_context(path):
def make_page_context(path):
context = resolve_route(path)
if not context:
raise frappe.DoesNotExistError
raise frappe.PageDoesNotExistError
context.doctype = context.ref_doctype
@ -440,4 +440,4 @@ def get_doctypes_with_web_view():
return frappe.cache().get_value('doctypes_with_web_view', _get)
def get_start_folders():
return frappe.local.flags.web_pages_folders or ('www', 'templates/pages')
return frappe.local.flags.web_pages_folders or ('www', 'templates/pages')