예제 #1
0
파일: filter.py 프로젝트: bazsi/codega
    def __decorator(func):
        if not has_mark(func, 'filters'):
            set_mark(func, 'filters', [])

        # Since the add_filter will mostly be used as a decorator and because decorators
        # are applied in reverse order (the closest one to the function definition gets
        # applied first) we should apply the new filter to the beginning of the list so
        # the filter statements are easier to read.
        get_mark(func, 'filters').insert(0, filter)

        return func
예제 #2
0
파일: object.py 프로젝트: bazsi/codega
    def __decorate(func):
        if not has_mark(func, 'matchers'):
            set_mark(func, 'matchers', [])

        get_mark(func, 'matchers').append(matcher)
        return func