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

pyramid integration not correctly parsing boolean settings #146

Closed
ezarowny opened this issue Nov 16, 2016 · 3 comments
Closed

pyramid integration not correctly parsing boolean settings #146

ezarowny opened this issue Nov 16, 2016 · 3 comments
Labels

Comments

@ezarowny
Copy link
Contributor

If you have boolean settings values in a paste config file, they will not be turned into booleans when parsing. For example, given the following config:

rollbar.debug = false
rollbar.verify_https = false

rollbar.SETTINGS will end up containing 'false' instead of False for the above values.

@ezarowny
Copy link
Contributor Author

Partial solution:

def parse_settings(settings):
    prefix = 'rollbar.'
    out = {}
    for k, v in settings.items():
        if k.startswith(prefix):
            if k in BOOLEAN_SETTINGS:
                v = asbool(v)
            out[k[len(prefix):]] = v

    return out

Unfortunately, this will only cover top-level items. It doesn't seem like you'd be able to nest settings in paste configs though?

@coryvirok
Copy link
Contributor

@ezarowny can this be closed?

@coryvirok coryvirok added the bug label Jun 12, 2017
@ezarowny
Copy link
Contributor Author

ezarowny commented Jun 13, 2017

Yeah, let's close this. I'll update the docs and add a section about how to handle nested config items with Pyramid.

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

No branches or pull requests

2 participants