-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flask 0.10.1, app_context and "_AppCtxGlobals object has no 'identity'" #26
Comments
I believe there was some changes to how the contexts (app and request) are handled between Flask version. But you're problem lies in the fact that flask-principal only works when there is a a request context. See this code. In the context of a Flask-Script command you only have an app context. |
Thanks much. I guess flask 0.9's bundling of a bunch of request context stuff into the app context was a convenient (but sadly incorrect) accident. |
The trick will be to update the identity to be that of the user that initiated the delayed task in the context of the Celery app. You could send the user's ID along as an argument to the task, then load the user before doing anything else, then construct the |
Thanks much. Gives me some idea of where to start :) On Mon, Dec 23, 2013 at 3:47 PM, Matt Wright notifications@github.comwrote:
|
Closing as solved. |
I've got an issue that I don't quite know how to articulate but it's due to updates in Flask from 0.9 -> 0.10. I'm using Flask-Principal==0.4.0, Flask-Login==0.2.7.
I've got a permission-decorated function that's somethink like the below:
content_editor_role is defined as:
Something changed between between flask==0.9 and flask==0.10.1 which is causing the below exception stack to be thrown on this decorated (permission-restricted) function:
Note that this happens ONLY when I run this from a flask-script through an app_context():
And this basically is telling me that something is weird when I use the app_context to "fake" a user's identity.
I'm posting this here in case anyone knows what this might be from, since I'm at a bit of a loss. I'm going to start looking at the source to see if I can trace anything, but would appreciate any suggestions as well.
Thanks much!
The text was updated successfully, but these errors were encountered: