In python, is it possible to detect if there is a decorator on another function?
Specifically, I'm trying (in django) to write some middleware that will detect if the view being processed has been wrapped in the @login_required decorator.
class SomeMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
if has_decorator(view_func):
print "this view was decorated"
What I'm trying to fill in is the "has_decorator" portion....
Is this possible?