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 datatype for boolean values #71

Merged
merged 1 commit into from May 16, 2019
Merged

fix datatype for boolean values #71

merged 1 commit into from May 16, 2019

Conversation

cehbrecht
Copy link
Member

sqlite does not handle boolean values and we use integer. This PR tries to handle the boolean parameter handling (public, verify) for both sqlite and postgres.

@cehbrecht cehbrecht added the bug label May 16, 2019
@cehbrecht cehbrecht added this to the 0.5.0 milestone May 16, 2019
@cehbrecht cehbrecht self-assigned this May 16, 2019
@cehbrecht cehbrecht added this to In progress in San Francisco: Spring 2019 Release via automation May 16, 2019
@cehbrecht
Copy link
Member Author

@fmigneault not a nice patch ... but it currently works for me.

@cehbrecht cehbrecht merged commit a755453 into master May 16, 2019
San Francisco: Spring 2019 Release automation moved this from In progress to Done May 16, 2019
@cehbrecht cehbrecht deleted the fix-datatype-boolean branch May 16, 2019 12:41
Copy link
Contributor

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

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

The only problem I find with this is that if the field is accessed with service['public'] instead of service.public, we get different values. I have used overrides of __getattr__ in previous projects to solve exactly this potential issue.
Maybe I can dig them up if we feel this becomes problematic here.

@@ -50,7 +50,10 @@ def has_purl(self):
def public(self):
"""Flag if service has public access."""
# TODO: public access can be set via auth parameter.
return self.get('public') or False
value = self.get('public', False)
if value is True or value == 1 or value == 'true':
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use pyramid.settings.asbool which handles more use cases, but this is still ok for now.

@cehbrecht cehbrecht mentioned this pull request May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants