Skip to content

Commit abd0187

Browse files
committed
refactor: drop _allow_dict support
This is not required anymore since we store full doc anyway. Also since they share same cache key calling get_cached_value and get_cached_doc can end up doing duplicate / double work.
1 parent b529c27 commit abd0187

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

frappe/__init__.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,21 +1063,9 @@ def set_value(doctype, docname, fieldname, value=None):
10631063
return frappe.client.set_value(doctype, docname, fieldname, value)
10641064

10651065

1066-
@overload
1067-
def get_cached_doc(doctype, docname, _allow_dict=True) -> dict:
1068-
...
1069-
1070-
1071-
@overload
10721066
def get_cached_doc(*args, **kwargs) -> "Document":
1073-
...
1074-
1075-
1076-
def get_cached_doc(*args, **kwargs):
1077-
allow_dict = kwargs.pop("_allow_dict", False)
1078-
10791067
def _respond(doc, from_redis=False):
1080-
if not allow_dict and isinstance(doc, dict):
1068+
if isinstance(doc, dict):
10811069
local.document_cache[key] = doc = get_doc(doc)
10821070

10831071
elif from_redis:
@@ -1150,7 +1138,7 @@ def get_cached_value(
11501138
doctype: str, name: str, fieldname: str = "name", as_dict: bool = False
11511139
) -> Any:
11521140
try:
1153-
doc = get_cached_doc(doctype, name, _allow_dict=True)
1141+
doc = get_cached_doc(doctype, name)
11541142
except DoesNotExistError:
11551143
clear_last_message()
11561144
return

0 commit comments

Comments
 (0)