def action_log_decorator(func): global sender global osuserid global action_log_decorator_initialized if not action_log_decorator_initialized: action_log_decorator_initialized = True config = _settings.get_config() if config is not None: sender = Sender(config) else: sender = _null_sender id = _settings.get_osuserid() if id is not None: osuserid = id else: osuserid = _init_osuserid from functools import wraps @wraps(func) def wrapper(request, *args, **kwargs): devicename = to_device_name(request.META) with ActionLogger(sender, getattr(request, osuserid), devicename): return func(request, *args, **kwargs) return wrapper
def __init__(self): global sender global osuserid config = _settings.get_config() if config is not None: sender = Sender(config) else: sender = _null_sender id = _settings.get_osuserid() if id is not None: osuserid = id else: osuserid = _init_osuserid