forked from frappe/frappe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'version-14' of https://github.com/frappe/frappe into ve…
…rsion-14
- Loading branch information
Showing
373 changed files
with
2,067 additions
and
2,816 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
"allow_tests": true, | ||
"db_type": "mariadb", | ||
"auto_email_id": "[email protected]", | ||
"mail_server": "smtp.example.com", | ||
"mail_server": "localhost", | ||
"mail_port": 2525, | ||
"mail_login": "[email protected]", | ||
"mail_password": "test", | ||
"admin_password": "admin", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
"db_type": "postgres", | ||
"allow_tests": true, | ||
"auto_email_id": "[email protected]", | ||
"mail_server": "smtp.example.com", | ||
"mail_server": "localhost", | ||
"mail_port": 2525, | ||
"mail_login": "[email protected]", | ||
"mail_password": "test", | ||
"admin_password": "admin", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
) | ||
from .utils.lazy_loader import lazy_import | ||
|
||
__version__ = "14.62.2" | ||
__version__ = "14.66.2" | ||
__title__ = "Frappe Framework" | ||
|
||
controllers = {} | ||
|
@@ -53,9 +53,7 @@ | |
|
||
_dev_server = int(sbool(os.environ.get("DEV_SERVER", False))) | ||
_qb_patched = {} | ||
re._MAXCACHE = ( | ||
50 # reduced from default 512 given we are already maintaining this on parent worker | ||
) | ||
re._MAXCACHE = 50 # reduced from default 512 given we are already maintaining this on parent worker | ||
|
||
_tune_gc = bool(sbool(os.environ.get("FRAPPE_TUNE_GC", True))) | ||
|
||
|
@@ -258,9 +256,7 @@ def init(site: str, sites_path: str = ".", new_site: bool = False, force=False) | |
local.initialised = True | ||
|
||
|
||
def connect( | ||
site: str | None = None, db_name: str | None = None, set_admin_as_user: bool = True | ||
) -> None: | ||
def connect(site: str | None = None, db_name: str | None = None, set_admin_as_user: bool = True) -> None: | ||
"""Connect to site database instance. | ||
:param site: If site is given, calls `frappe.init`. | ||
|
@@ -780,9 +776,7 @@ def is_whitelisted(method): | |
is_guest = session["user"] == "Guest" | ||
if method not in whitelisted or is_guest and method not in guest_methods: | ||
summary = _("You are not permitted to access this resource.") | ||
detail = _("Function {0} is not whitelisted.").format( | ||
bold(f"{method.__module__}.{method.__name__}") | ||
) | ||
detail = _("Function {0} is not whitelisted.").format(bold(f"{method.__module__}.{method.__name__}")) | ||
msg = f"<details><summary>{summary}</summary>{detail}</details>" | ||
throw(msg, PermissionError, title="Method Not Allowed") | ||
|
||
|
@@ -797,7 +791,6 @@ def is_whitelisted(method): | |
def read_only(): | ||
def innfn(fn): | ||
def wrapper_fn(*args, **kwargs): | ||
|
||
# frappe.read_only could be called from nested functions, in such cases don't swap the | ||
# connection again. | ||
switched_connection = False | ||
|
@@ -973,9 +966,7 @@ def has_permission( | |
) | ||
|
||
if throw and not out: | ||
document_label = ( | ||
f"{_(doctype)} {doc if isinstance(doc, str) else doc.name}" if doc else _(doctype) | ||
) | ||
document_label = f"{_(doctype)} {doc if isinstance(doc, str) else doc.name}" if doc else _(doctype) | ||
frappe.flags.error_message = _("No permission for {0}").format(document_label) | ||
raise frappe.PermissionError | ||
|
||
|
@@ -1156,9 +1147,7 @@ def clear_document_cache(doctype, name): | |
delattr(local, "website_settings") | ||
|
||
|
||
def get_cached_value( | ||
doctype: str, name: str, fieldname: str = "name", as_dict: bool = False | ||
) -> Any: | ||
def get_cached_value(doctype: str, name: str, fieldname: str = "name", as_dict: bool = False) -> Any: | ||
try: | ||
doc = get_cached_doc(doctype, name) | ||
except DoesNotExistError: | ||
|
@@ -1493,9 +1482,7 @@ def _is_valid_hook(obj): | |
return hooks | ||
|
||
|
||
def get_hooks( | ||
hook: str = None, default: Any | None = "_KEEP_DEFAULT_LIST", app_name: str = None | ||
) -> _dict: | ||
def get_hooks(hook: str = None, default: Any | None = "_KEEP_DEFAULT_LIST", app_name: str = None) -> _dict: | ||
"""Get hooks via `app/hooks.py` | ||
:param hook: Name of the hook. Will gather all hooks for this name and return as a list. | ||
|
@@ -1598,11 +1585,7 @@ def read_file(path, raise_not_found=False): | |
def get_attr(method_string: str) -> Any: | ||
"""Get python method object from its name.""" | ||
app_name = method_string.split(".", 1)[0] | ||
if ( | ||
not local.flags.in_uninstall | ||
and not local.flags.in_install | ||
and app_name not in get_installed_apps() | ||
): | ||
if not local.flags.in_uninstall and not local.flags.in_install and app_name not in get_installed_apps(): | ||
throw(_("App {0} is not installed").format(app_name), AppNotInstalledError) | ||
|
||
modulename = ".".join(method_string.split(".")[:-1]) | ||
|
@@ -1624,7 +1607,8 @@ def get_newargs(fn: Callable, kwargs: dict[str, Any]) -> dict[str, Any]: | |
"""Remove any kwargs that are not supported by the function. | ||
Example: | ||
>>> def fn(a=1, b=2): pass | ||
>>> def fn(a=1, b=2): | ||
... pass | ||
>>> get_newargs(fn, {"a": 2, "c": 1}) | ||
{"a": 2} | ||
|
@@ -1960,9 +1944,7 @@ def as_json(obj: dict | list, indent=1, separators=None) -> str: | |
separators = (",", ": ") | ||
|
||
try: | ||
return json.dumps( | ||
obj, indent=indent, sort_keys=True, default=json_handler, separators=separators | ||
) | ||
return json.dumps(obj, indent=indent, sort_keys=True, default=json_handler, separators=separators) | ||
except TypeError: | ||
# this would break in case the keys are not all os "str" type - as defined in the JSON | ||
# adding this to ensure keys are sorted (expected behaviour) | ||
|
@@ -2048,10 +2030,7 @@ def get_print( | |
if not html: | ||
html = get_response_content("printview") | ||
|
||
if as_pdf: | ||
return get_pdf(html, options=pdf_options, output=output) | ||
else: | ||
return html | ||
return get_pdf(html, options=pdf_options, output=output) if as_pdf else html | ||
|
||
|
||
def attach_print( | ||
|
@@ -2212,9 +2191,7 @@ def _get_doctype_app(): | |
log_level = None | ||
|
||
|
||
def logger( | ||
module=None, with_more_info=False, allow_site=True, filter=None, max_size=100_000, file_count=20 | ||
): | ||
def logger(module=None, with_more_info=False, allow_site=True, filter=None, max_size=100_000, file_count=20): | ||
"""Returns a python logger that uses StreamHandler""" | ||
from frappe.utils.logger import get_logger | ||
|
||
|
@@ -2260,9 +2237,7 @@ def log_error(title=None, message=None, reference_doctype=None, reference_name=N | |
|
||
|
||
def get_desk_link(doctype, name): | ||
html = ( | ||
'<a href="/app/Form/{doctype}/{name}" style="font-weight: bold;">{doctype_local} {name}</a>' | ||
) | ||
html = '<a href="/app/Form/{doctype}/{name}" style="font-weight: bold;">{doctype_local} {name}</a>' | ||
return html.format(doctype=doctype, name=name, doctype_local=_(doctype)) | ||
|
||
|
||
|
@@ -2313,7 +2288,7 @@ def get_version(doctype, name, limit=None, head=False, raise_err=True): | |
Note: Applicable only if DocType has changes tracked. | ||
Example | ||
>>> frappe.get_version('User', '[email protected]') | ||
>>> frappe.get_version("User", "[email protected]") | ||
>>> | ||
[ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.