Sagar Vora | 4205f56 | 2023-07-24 18:37:36 +0530 | [diff] [blame] | 1 | from contextlib import contextmanager |
2 | |||||
3 | import frappe | ||||
4 | |||||
5 | |||||
6 | @contextmanager | ||||
7 | def temporary_flag(flag_name, value): | ||||
8 | flags = frappe.local.flags | ||||
9 | flags[flag_name] = value | ||||
10 | try: | ||||
11 | yield | ||||
12 | finally: | ||||
13 | flags.pop(flag_name, None) |