Open postrational opened 8 years ago
can you please tell me why this is happen i am using flask restplus my code is from flask_jwt_extended import ( jwt_required, jwt_refresh_token_required, get_jwt_identity, get_raw_jwt )
ns1 = Namespace('brands', description='Cats related operations')
@ns1.before_first_request def set_up(): u = get_jwt_identity() if(u): user = User.query.filter_by(id=u).first() else: return forbidden('Not Log In') g.current_user = user
Hi there!
Keep up the great work you're doing on RestPlus. It's becoming a significant, fully featured framework.
There is a feature I would like to request. Sometimes we find a need to do some setup work before a request, in particular before the first request. We can currently use the Flask before_first_request decorator to do this.
It would be great if we didn't have to put these bindings globally in the flask app definition, but if we could keep them together with our API definitions.
To achieve this you could add the decorators
before_first_request
,before_request
andafter_request
to the RestPlusAPI
andNamespace
classes, so I could do something like: