コード例 #1
0
ファイル: actionlog.py プロジェクト: arpsabbir/anchovy
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
コード例 #2
0
ファイル: actionlog.py プロジェクト: arpsabbir/anchovy
 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
コード例 #3
0
ファイル: actionlog.py プロジェクト: subc/anchovy
 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
コード例 #4
0
ファイル: actionlog.py プロジェクト: subc/anchovy
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