web.config

Here are the examples of the python api web.config taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: broadgauge Source File: oauth.py
Function: get_oauth_services
def get_oauth_services():
    """Returns an iterator over the available oauth services.

    Each entry in the iterator will be a storage object containing
    id and name of the service. For example:

        web.storage(name='gitbub', title='GitHub')
    """
    if 'github_client_id' in web.config:
        yield web.storage(name='github', title='GitHub')
    if 'google_client_id' in web.config:
        yield web.storage(name='google', title='Google')
    if 'facebook_client_id' in web.config:
        yield web.storage(name='facebook', title='Facebook')

Example 2

Project: broadgauge Source File: utils.py
def setup_error_emails(app):
    if "smtp_server" in web.config and "bug_master" in web.config:
        app.internalerror = web.emailerrors(
            web.config.bug_master,
            app.internalerror,
            web.config.from_address)

Example 3

Project: broadgauge Source File: main.py
def load_config_from_env():
    keys = [
        'SITE_TITLE',
        'GITHUB_CLIENT_ID',
        'GITHUB_CLIENT_SECRET',
        'GOOGLE_CLIENT_ID',
        'GOOGLE_CLIENT_SECRET',
        'FACEBOOK_CLIENT_ID',
        'FACEBOOK_CLIENT_SECRET',
        'SECRET_KEY',
        'DATABASE_URL',
        'ADMIN_USER',
        'SMTP_SERVER',
        'SMTP_POST',
        'SMTP_USERNAME',
        'SMTP_PASSWORD',
        'SMTP_STARTTLS',
        'FROM_ADDRESS',
        'CONTACT_EMAIL'
    ]

    for k in keys:
        if k in os.environ:
            web.config[k.lower()] = os.environ[k]

    # auto add all keys for format BROADGAUGE_xxx to config
    for k in os.environ:
        if k.startswith('BROADGAUGE_'):
            k2 = k[len('BROADGAUGE_'):].lower()
            web.config[k2] = os.environ[k]

Example 4

Project: python-social-auth Source File: webpy_strategy.py
Function: get_setting
    def get_setting(self, name):
        return getattr(web.config, name)