-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TypeError on loading PyramidStrategy #390
Comments
I've run into this issue during development as well. I'm planning on setting up a pull request soon, but in the interim, I've just patched their pyramid_app strategy in order to get things running. I've got a monkey patch for it that seems to get things up and running (see below). After you've applied the patch, make sure to change the function for your "login_user" the take the parameters Here's the patch (call it at the top of your app/init.py file with all the config setup):
|
Another issue with their pyramid implementation seems to be that the storage engine they're using (sqlalchemy_orm) isn't flushing the ORM session after the commit, so the user_id never actually makes it into the request's session. |
Thanks @amilstead . It works after I did some thing like your patch. |
I've pushed the fix to the @amilstead, I'm not sure what you mean. |
@omab I was experiencing some funniness with the model that was coming through inside login callback functions. Specifically, I narrowed down that in this file: https://github.com/omab/python-social-auth/blob/master/social/storage/sqlalchemy_orm.py#L40 there should be a call to Upon new users signing up/registering via the PSA system on a pyramid framework, a user object will be passed to the "SOCIAL_AUTH_LOGIN_FUNCTION" (defined in settings). That user, if the session it was created under had never been flushed, will end up with an id of You can test this by using the example project https://github.com/omab/python-social-auth/blob/master/examples/pyramid_example/example in a simple dev environment to see what I'm talking about (one thing you'll have to change is the parameters to |
+1 @amilstead Working to integrate this on pyramid+sqlalchemy and have the same problem ;( |
I've pushed the |
Hey @omab , I just tested and it's failed. I try to create a test for that. To reproduce the test, start from a empty db (or remove users table) and try to login (I took twitter as example), Done page failed because request.user is none:
|
@jeromelefeuvre, I've pushed another fix. I was able to reproduce the issue with a fresh db (thanks), the last fix seems to do the trick, could you test again please? |
+1. You rocks ! |
My question is "How to logout in pyramid ?" |
Removing the sessions value should be enough to logout the user, but that second user with the extra hash, means that it's failing to detect the already created user in the previous login. Let me check it. |
Hi, I am going to use python-social-auth with Pyramid, but meet the following problem:
PyramidStrategy takes 3 arguments on init: https://github.com/omab/python-social-auth/blob/master/social/strategies/pyramid_strategy.py#L22
But load_strategy only passes 2 arguments: https://github.com/omab/python-social-auth/blob/master/social/apps/pyramid_app/utils.py#L24
It will raises TypeError which makes python-social-auth never working with Pyramid:
The text was updated successfully, but these errors were encountered: