jumpserver/apps/common/local.py

18 lines
346 B
Python
Raw Normal View History

from werkzeug.local import Local
2019-06-25 06:32:25 +00:00
2023-03-09 03:15:18 +00:00
from django.utils import translation
2019-06-25 06:32:25 +00:00
thread_local = Local()
2023-03-09 03:15:18 +00:00
encrypted_field_set = {'password', 'secret'}
2019-06-25 06:32:25 +00:00
def _find(attr):
return getattr(thread_local, attr, None)
def add_encrypted_field_set(label):
if label:
2023-03-09 03:15:18 +00:00
with translation.override('en'):
encrypted_field_set.add(str(label))