candango/cartola

Prospect decorators(annotations) from classes and methods of a class

piraz opened this issue · 0 comments

piraz commented

This is necessary to check some annotations before the method be touched.

For instance:

We want to implement an action to be executed in a before_action method of a TornadoHandler. Inside the before_action we want to check if the current method being executed(i.e get, post, delete, etc...) has a skip_action decorator.

Because we never reached the method get from TornadoHandler in run time there are no items in the annotations property of the current instance of TornadoHandler.get.

Let's add methods to prospect decorators from classes and methods using inspect and ast following the example from: