After some time working with ruby, I'm back to python. I'm working with the flask framework.
How do I implement a filter to run a method on the request at the start the controller action without putting the same code in every controller? My first guess is to construct a decorator of some sort(e.g. @before_request but that did not seem it on first glance). I'm just getting (re)acquainted with python and there are few things just out of reach, so any input appreciated. The equivalent is a before_filter in Rails or before do method in Sinatra.
There is a @app.before_request
constructor available as shown in the SQLite pattern given in the docs. This is run on every request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With