Possible to step into decorated functions?

I'm working on a Flask project and am using Flask-Principal.  One way to apply access checks is to use a decorator like:

def admin():
    return render_template('auth/admin.html')
How does one debug the decorator?  I've tried step in and force step in, but it doesn't seem to work.

Is there a way to step into the decorator?
1 comment
Comment actions Permalink
from functools import wraps

def decorator_generator(param):
    # let's say this is in some library far off, and heavily used. putting a breakpoint
    # on the print statement would yield 100's of debugs before the one you really one to
    # get into debugging... Setting a breakpoint here is useless.
    def decorator(func):
        def wrapper(*params, **vars):
            print param
            func(*params, **vars)

        return wrapper

    return decorator

def debug_decorator(func):
    def wrapper(*params, **vars):
        # set your breakpoint here (ctrl-f8)
        # step into the function (f7) to step into the decorator you want to debug
        func(*params, **vars)

    return wrapper

# add the debug decorator_generator's before the decorator you want to debug 
def foo():
    return 'bar'

if __name__ == '__main__':

The code could be improved if we can throw a breakpoint in the debbuger, but i couldn't find a way to do that.

@jetbrains, is there any way to ask for the debugger to intercept?

Please sign in to leave a comment.