[backends] Added better error handling when parsing the <backend>_EXTRA_DATA setting #766

Merged
merged 1 commit into from Sep 6, 2013

Projects

None yet

2 participants

@emilisto
emilisto commented Sep 6, 2013

I ran into some very confusing errors when setting the FOO_EXTRA_DATA variable in settings.py. First, there's a bug if you set

FOO_EXTRA_DATA = [
    ('user',)
]

Since the unpacking is faulty: name = alias = entry when it should instead be (name,) = (alias,) = entry.

Secondly, certain configuration errors result in a TypeError being thrown — which is unfortunately swallowed by Django's auth module. I re-worked the whole logic so that it's more thorough, and always gives visible exceptions — by instead throwing a BackendException that I introduced.

Also, I made the following work:

FOO_EXTRA_DATA = [ 'user' ]

Note: FOO goes for any backend, in my case I used the Instagram one.

@omab omab merged commit 7485ac3 into omab:master Sep 6, 2013
@omab
Owner
omab commented Sep 6, 2013

Thanks!

@emilisto
emilisto commented Sep 6, 2013

Thank you too for a great package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment