Merge remote-tracking branch 'upstream/develop' into feat-remove-failed-queue

This commit is contained in:
Rohan Bansal 2021-02-03 14:48:59 +05:30
commit ba99b0be33
8 changed files with 29 additions and 13 deletions

View file

@ -1,8 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""
globals attached to frappe module
+ some utility functions that should probably be moved
Frappe - Low Code Open Source Framework in Python and JS
Frappe, pronounced fra-pay, is a full stack, batteries-included, web
framework written in Python and Javascript with MariaDB as the database.
It is the framework which powers ERPNext. It is pretty generic and can
be used to build database driven apps.
Read the documentation: https://frappeframework.com/docs
"""
from __future__ import unicode_literals, print_function

View file

@ -562,6 +562,10 @@ def get_perm_info(role):
@frappe.whitelist(allow_guest=True)
def update_password(new_password, logout_all_sessions=0, key=None, old_password=None):
#validate key to avoid key input like ['like', '%'], '', ['in', ['']]
if key and not isinstance(key, str):
frappe.throw(_('Invalid key type'))
result = test_password_strength(new_password, key, old_password)
feedback = result.get("feedback", None)

View file

@ -7,12 +7,13 @@ def validate_route_conflict(doctype, name):
'''
Raises exception if name clashes with routes from other documents for /app routing
'''
if frappe.flags.ignore_route_conflict_validation:
return
all_names = []
for _doctype in ['Page', 'Workspace', 'DocType']:
all_names.extend([slug(d) for d in frappe.get_all(_doctype, pluck='name') if (doctype != _doctype and d != name)])
try:
all_names.extend([slug(d) for d in frappe.get_all(_doctype, pluck='name') if (doctype != _doctype and d != name)])
except frappe.db.TableMissingError:
pass
if slug(name) in all_names:
frappe.msgprint(frappe._('Name already taken, please set a new name'))

View file

@ -297,8 +297,9 @@ def inline_style_in_html(html):
for app in apps:
path = 'assets/{0}/css/email.css'.format(app)
if os.path.exists(os.path.abspath(path)):
css_files.append(path)
css_files.append(path)
css_files = [css_file for css_file in css_files if os.path.exists(os.path.abspath(css_file))]
p = Premailer(html=html, external_styles=css_files, strip_important=False)

View file

@ -327,5 +327,5 @@ execute:frappe.delete_doc_if_exists('Page', 'workspace')
execute:frappe.delete_doc_if_exists('Page', 'dashboard', force=1)
frappe.core.doctype.page.patches.drop_unused_pages
execute:frappe.get_doc('Role', 'Guest').save() # remove desk access
frappe.patches.v13_0.rename_desk_page_to_workspace
frappe.patches.v13_0.rename_desk_page_to_workspace # 02.02.2021
frappe.patches.v13_0.delete_package_publish_tool

View file

@ -13,7 +13,9 @@ def execute():
rename_doc('DocType', 'Desk Chart', 'Workspace Chart', ignore_if_exists=True)
rename_doc('DocType', 'Desk Shortcut', 'Workspace Shortcut', ignore_if_exists=True)
if frappe.db.exists('DocType', 'Desk Link'):
rename_doc('DocType', 'Desk Link', 'Workspace Link', ignore_if_exists=True)
rename_doc('DocType', 'Desk Link', 'Workspace Link', ignore_if_exists=True)
frappe.reload_doc('desk', 'doctype', 'workspace')
frappe.reload_doc('desk', 'doctype', 'workspace', force=True)
frappe.reload_doc('desk', 'doctype', 'workspace_link', force=True)
frappe.reload_doc('desk', 'doctype', 'workspace_chart', force=True)
frappe.reload_doc('desk', 'doctype', 'workspace_shortcut', force=True)

View file

@ -2,6 +2,8 @@ from __future__ import unicode_literals
import frappe
def execute():
if not frappe.db.exists('Desk Page'): return
pages = frappe.get_all("Desk Page", filters={ "is_standard": False }, fields=["name", "extends", "for_user"])
default_icon = {}
for page in pages:

View file

@ -259,7 +259,7 @@ frappe.views.InteractionComposer = class InteractionComposer {
args: {
doctype: doc.doctype,
name: doc.name,
assign_to: assignee,
assign_to: JSON.stringify([assignee]),
},
callback:function(r) {
if(!r.exc) {
@ -334,4 +334,4 @@ function get_doc_mappings() {
};
return doc_map;
}
}