Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow SOCIAL_<PROVIDER> settings to be None #13

Merged
merged 1 commit into from

2 participants

@joeyespo

With this, you can be explicit about what settings are expected
in your root settings.py file. SOCIAL_FACEBOOK can be None, for
example, and overridden in another file or in the environment.

Here's my personal setup:

SOCIAL_TWITTER = {
    'consumer_key': os.environ.get('TWITTER_CONSUMER_KEY'),
    'consumer_secret': os.environ.get('TWITTER_CONSUMER_SECRET'),
} if os.environ.get('TWITTER_CONSUMER_KEY') else None

It would be ideal if 'consumer_key' could allow None, but I didn't want
to break the OAuth mechanism in this commit, so this is good enough.

@joeyespo joeyespo Allow SOCIAL_<PROVIDER> settings to be None.
With this, you can be explicit about what settings are expected
in your root settings.py file. SOCIAL_FACEBOOK can be None, for
example, and overridden in another file or in the environment.

Here's my personal setup:

    SOCIAL_TWITTER = {
        'consumer_key': os.environ.get('TWITTER_CONSUMER_KEY'),
        'consumer_secret': os.environ.get('TWITTER_CONSUMER_SECRET'),
    } if os.environ.get('TWITTER_CONSUMER_KEY') else None

It would be ideal if 'consumer_key' could allow None, but I didn't want
to break the OAuth mechanism in this commit, so this is good enough.
ae1e5ac
@mattupstate
Owner

Makes sense. Thanks!

@mattupstate mattupstate merged commit 9867ac0 into mattupstate:develop
@joeyespo joeyespo deleted the joeyespo:nullable-settings branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 21, 2013
  1. @joeyespo

    Allow SOCIAL_<PROVIDER> settings to be None.

    joeyespo authored
    With this, you can be explicit about what settings are expected
    in your root settings.py file. SOCIAL_FACEBOOK can be None, for
    example, and overridden in another file or in the environment.
    
    Here's my personal setup:
    
        SOCIAL_TWITTER = {
            'consumer_key': os.environ.get('TWITTER_CONSUMER_KEY'),
            'consumer_secret': os.environ.get('TWITTER_CONSUMER_SECRET'),
        } if os.environ.get('TWITTER_CONSUMER_KEY') else None
    
    It would be ideal if 'consumer_key' could allow None, but I didn't want
    to break the OAuth mechanism in this commit, so this is good enough.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  flask_social/core.py
View
2  flask_social/core.py
@@ -120,7 +120,7 @@ def init_app(self, app, datastore=None):
providers = dict()
for key, config in app.config.items():
- if not key.startswith('SOCIAL_') or key in default_config:
+ if not key.startswith('SOCIAL_') or config is None or key in default_config:
continue
suffix = key.lower().replace('social_', '')
Something went wrong with that request. Please try again.