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

Fix bug using bool to test prefer_english_names #370

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adamcandy
Copy link
Contributor

Fixes a bug in PR 290 and closes issue #369 (Prefer English names logic is broken).

bool cannot be used to test for a True or False string in python.

This uses the standard routine distutils.util.strtobool to check the string provided in config.ini. This will correctly interpret: y, yes, t, true, on, 1, false, n, no, f, false, off, 0 and is case-insensitive.

I'm not sure how this slipped through the tests before...

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 91.078% when pulling 30a28cc on adamcandy:fix-bool-prefer-english-names into 8e95b96 on jmathai:master.

@@ -135,7 +136,7 @@ def get_prefer_english_names():
if('prefer_english_names' not in config['MapQuest']):
return False

__PREFER_ENGLISH_NAMES__ = bool(config['MapQuest']['prefer_english_names'])
__PREFER_ENGLISH_NAMES__ = bool(strtobool(config['MapQuest']['prefer_english_names']))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I think we can eliminate the bool() call here.

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.

3 participants