Skip to content
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

Make get_username in pipeline a functor. #253

Closed
wants to merge 2 commits into from
Closed

Conversation

mpessas
Copy link

@mpessas mpessas commented Feb 15, 2012

This allows us to factor out the check for the existence of a username, so that
it is easier to override and customize in subclasses.

One of the reasons that this is needed is that django-userena considers two usernames that differ only in case to be the same, while the default behavior of django-social-auth does not. As a result, userena will fail with a MultipleObjectsReturned exception.

With this change, developers will only have to subclass GetPassword and override just the username_exists method.

Apostolos Bessas added 2 commits February 15, 2012 17:36
This allows us to factor out the check for the existence of a username, so that
it is easier to override and customize in subclasses.
@omab
Copy link
Owner

omab commented Feb 15, 2012

I'm not in favor of the class with a call(), instead I've added a override option for the user exists check, you will be able to create your pipeline get_username that calls the original one with a function that implements the needed check.

@omab omab closed this Feb 15, 2012
@mpessas
Copy link
Author

mpessas commented Feb 15, 2012

The thing is, that I was thinking of having more things "configurable", like how a random username would be generated (just nice to have), which would be easier to do with a functor than adding another function as a parameter or in settings.
But ok, since the main problem is solved, thanks!

@omab
Copy link
Owner

omab commented Feb 15, 2012

Things being configurable is the purpose of the pipeline, if the default behavior doesn't fit, then it's the time to implement the needed functionality for the project as a new pipeline item.

The main idea is to have small functions that do the work properly. But DSA aims to provide a default basic behavior, not cover all the possible cases or it will end like a big classes collection with lot of overrideable methods for "just in case" scenarios.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants