diff --git a/frappe/__init__.py b/frappe/__init__.py index bec6b74ac1..1ad39e0b32 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '9.1.10' +__version__ = '9.1.11' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/desk/notifications.py b/frappe/desk/notifications.py index f93a3b4c0f..93cf23c120 100644 --- a/frappe/desk/notifications.py +++ b/frappe/desk/notifications.py @@ -161,7 +161,9 @@ def clear_notifications(user=None): return config = get_notification_config() - groups = list(config.get("for_doctype").keys()) + list(config.get("for_module").keys()) + for_doctype = config.get('for_doctype').keys() if config.get('for_doctype') else [] + for_module = list(config.get('for_module').keys()) if config.get('for_module') else [] + groups = for_doctype + for_module cache = frappe.cache() for name in groups: @@ -206,11 +208,13 @@ def get_notification_info_for_boot(): def get_notification_config(): def _get(): config = frappe._dict() - for notification_config in frappe.get_hooks().notification_config: - nc = frappe.get_attr(notification_config)() - for key in ("for_doctype", "for_module", "for_other", "targets"): - config.setdefault(key, {}) - config[key].update(nc.get(key, {})) + hooks = frappe.get_hooks() + if hooks: + for notification_config in hooks.notification_config: + nc = frappe.get_attr(notification_config)() + for key in ("for_doctype", "for_module", "for_other", "targets"): + config.setdefault(key, {}) + config[key].update(nc.get(key, {})) return config return frappe.cache().get_value("notification_config", _get) diff --git a/frappe/utils/password_strength.py b/frappe/utils/password_strength.py index 95454bf249..a6b8f3f2a9 100644 --- a/frappe/utils/password_strength.py +++ b/frappe/utils/password_strength.py @@ -7,6 +7,7 @@ from zxcvbn import zxcvbn import frappe from frappe import _ + def test_password_strength(password, user_inputs=None): '''Wrapper around zxcvbn.password_strength''' result = zxcvbn(password, user_inputs) @@ -35,6 +36,7 @@ default_feedback = { ], } + def get_feedback(score, sequence): """ Returns the feedback dictionary consisting of ("warning","suggestions") for the given sequences. @@ -66,6 +68,7 @@ def get_feedback(score, sequence): } return feedback + def get_match_feedback(match, is_sole_match): """ Returns feedback as a dictionary for a certain match @@ -81,32 +84,32 @@ def get_match_feedback(match, is_sole_match): def fun_spatial(): feedback = { "warning": _('Short keyboard patterns are easy to guess'), - "suggestions":[ - _("Make use of longer keyboard patterns") + "suggestions": [ + _("Make use of longer keyboard patterns") ], } if match.get("turns") == 1: feedback = { "warning": _('Straight rows of keys are easy to guess'), - "suggestions":[ - _("Try to use a longer keyboard pattern with more turns") + "suggestions": [ + _("Try to use a longer keyboard pattern with more turns") ], } return feedback def fun_repeat(): - feedback ={ + feedback = { "warning": _('Repeats like "abcabcabc" are only slightly harder to guess than "abc"'), - "suggestions":[ + "suggestions": [ _("Try to avoid repeated words and characters") ], } - if len(match["repeated_char"]) == 1: + if len(match.get("repeated_char")) == 1: feedback = { "warning": _('Repeats like "aaa" are easy to guess'), - "suggestions":[ + "suggestions": [ _("Let's avoid repeated words and characters") ], } @@ -114,7 +117,7 @@ def get_match_feedback(match, is_sole_match): def fun_sequence(): return { - "suggestions":[ + "suggestions": [ _("Avoid sequences like abc or 6543 as they are easy to guess") ], } @@ -123,7 +126,7 @@ def get_match_feedback(match, is_sole_match): if match["regex_name"] == "recent_year": return { "warning": _("Recent years are easy to guess."), - "suggestions":[ + "suggestions": [ _("Avoid recent years."), _("Avoid years that are associated with you.") ], @@ -132,7 +135,7 @@ def get_match_feedback(match, is_sole_match): def fun_date(): return { "warning": _("Dates are often easy to guess."), - "suggestions":[ + "suggestions": [ _("Avoid dates and years that are associated with you.") ], }