style: use walrus operator
This commit is contained in:
parent
f6c546159c
commit
dc4d07cb61
1 changed files with 2 additions and 4 deletions
|
|
@ -850,8 +850,7 @@ def set_value(doctype, docname, fieldname, value=None):
|
|||
return frappe.client.set_value(doctype, docname, fieldname, value)
|
||||
|
||||
def get_cached_doc(*args, **kwargs):
|
||||
key = can_cache_doc(args)
|
||||
if key:
|
||||
if key := can_cache_doc(args):
|
||||
# local cache
|
||||
doc = local.document_cache.get(key)
|
||||
if doc:
|
||||
|
|
@ -930,8 +929,7 @@ def get_doc(*args, **kwargs):
|
|||
doc = frappe.model.document.get_doc(*args, **kwargs)
|
||||
|
||||
# set in cache
|
||||
key = can_cache_doc(args)
|
||||
if key:
|
||||
if key := can_cache_doc(args):
|
||||
local.document_cache[key] = doc
|
||||
cache().hset('document_cache', key, doc.as_dict())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue