Skip to content

Commit

Permalink
Merge branch 'develop' into remove-deprecated-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
phot0n committed Mar 6, 2023
2 parents 71a1cdc + 8368b73 commit db92d1c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 12 deletions.
3 changes: 3 additions & 0 deletions frappe/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,9 @@ def rollback(self, *, save_point=None):
obj.on_rollback()
frappe.local.rollback_observers = []

frappe.local.realtime_log = []
frappe.flags.enqueue_after_commit = []

def field_exists(self, dt, fn):
"""Return true of field exists."""
return self.exists("DocField", {"fieldname": fn, "parent": dt})
Expand Down
1 change: 1 addition & 0 deletions frappe/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,4 @@ execute:frappe.delete_doc("Page", "activity", force=1)
frappe.patches.v14_0.disable_email_accounts_with_oauth
execute:frappe.delete_doc("Page", "translation-tool", force=1)
frappe.patches.v15_0.remove_prepared_report_settings_from_system_settings
frappe.patches.v14_0.remove_manage_subscriptions_from_navbar
10 changes: 10 additions & 0 deletions frappe/patches/v14_0/remove_manage_subscriptions_from_navbar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import frappe


def execute():
navbar_settings = frappe.get_single("Navbar Settings")
for i, l in enumerate(navbar_settings.settings_dropdown):
if l.item_label == "Manage Subscriptions":
navbar_settings.settings_dropdown.pop(i)
navbar_settings.save()
break
6 changes: 3 additions & 3 deletions frappe/public/js/frappe/widgets/quick_list_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ export default class QuickListWidget extends Widget {
this.footer.empty();

let filters = frappe.utils.get_filter_from_json(this.quick_list_filter);
if (filters) {
frappe.route_options = filters;
}
let route = frappe.utils.generate_route({ type: "doctype", name: this.document_type });
this.see_all_button = $(`
<div class="see-all btn btn-xs">${__("View List")}</div>
Expand All @@ -253,6 +250,9 @@ export default class QuickListWidget extends Widget {
if (e.ctrlKey || e.metaKey) {
frappe.open_in_new_tab = true;
}
if (filters) {
frappe.route_options = filters;
}
frappe.set_route(route);
});
}
Expand Down
11 changes: 11 additions & 0 deletions frappe/tests/test_website.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,17 @@ def test_safe_render(self):
self.assertIn("test.__test", content)
self.assertNotIn("frappe.exceptions.ValidationError: Illegal template", content)

def test_never_render(self):
from pathlib import Path
from random import choices

WWW = Path(frappe.get_app_path("frappe")) / "www"
FILES_TO_SKIP = choices(list(WWW.glob("**/*.py*")), k=10)

for suffix in FILES_TO_SKIP:
content = get_response_content(suffix.relative_to(WWW))
self.assertIn("404", content)

def test_metatags(self):
content = get_response_content("/_test/_test_metatags")
self.assertIn('<meta name="title" content="Test Title Metatag">', content)
Expand Down
7 changes: 0 additions & 7 deletions frappe/utils/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@ def add_standard_navbar_items():
"action": "frappe.ui.toolbar.route_to_user()",
"is_standard": 1,
},
{
"item_label": "Manage Subscriptions",
"item_type": "Action",
"action": "frappe.ui.toolbar.redirectToUrl()",
"hidden": 1,
"is_standard": 1,
},
{
"item_label": "Session Defaults",
"item_type": "Action",
Expand Down
10 changes: 8 additions & 2 deletions frappe/website/page_renderers/template_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import io
import os
from importlib.machinery import all_suffixes

import click

Expand All @@ -17,6 +17,8 @@
is_binary_file,
)

PY_LOADER_SUFFIXES = tuple(all_suffixes())

WEBPAGE_PY_MODULE_PROPERTIES = (
"base_template_path",
"template",
Expand Down Expand Up @@ -66,7 +68,11 @@ def set_template_path(self):
return

def can_render(self):
return hasattr(self, "template_path") and bool(self.template_path)
return (
hasattr(self, "template_path")
and self.template_path
and not self.template_path.endswith(PY_LOADER_SUFFIXES)
)

@staticmethod
def get_index_path_options(search_path):
Expand Down

0 comments on commit db92d1c

Please sign in to comment.