omab/django-social-auth — Issue #257: Can't access partial_pipeline session variables when creating new user
Author: ajt
Created: 2012-02-18 17:29:54+00:00
State: open

I am using the ```SOCIAL_AUTH_PIPELINE``` to create a form that will allow a new user that is registering to create their own username. In the form I am creating, I would like to ```slugify``` their Facebook fullname for the form's deault, but I am unable to access the ```partial_pipeline``` variables from ```request.session``` during the registration process. Here is my pipeline:

SOCIAL_AUTH_PIPELINE = {
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.associate.associate_by_email',
'social_auth.backends.pipeline.misc.save_status_to_session',
'main.pipeline.redirect_to_socialsignup_form',
'main.pipeline.username',
'social_auth.backends.pipeline.user.create_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
}

and here is the relavent portion of my view that is used during the ```'main.pipeline.redirect_to_socialsignup_form',``` pipeline:

def social_signup(request):
username = slugify(request.session.get("partial_pipeline")['kwargs']['details']['fullname'])

When the user is new, and encounters this view, I get this error:

-> username = slugify(request.session.get("partial_pipeline")['kwargs']['details']['fullname'])
(Pdb) username
*** NameError: name 'username' is not defined

But if the user has been through the signup process once, this works with no problem. It looks like I am trying to access the ```partial_pipeline``` variables before they have been set. Should I re-arrange my pipeline or is there a different way I should be trying to access this information?