Пример #1
0
def register(name_or_test_func=None):
    if callable(name_or_test_func):
        permissions.register(name_or_test_func.__name__, name_or_test_func)
        return name_or_test_func
    else:
        def decorator(test_func):
            permissions.register(name_or_test_func, test_func)
            return test_func
        return decorator
Пример #2
0
from doorman import permissions


def can_do_stuff(*args, **kwargs):
    return True


permissions.register('can_do_stuff', can_do_stuff)


def can_do_other_stuff(*args, **kwargs):
    return True
Пример #3
0
 def decorator(test_func):
     permissions.register(name_or_test_func, test_func)
     return test_func