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

'active': 'True' or a 'active': True (bool) needs a review #2593

Open
ReimarBauer opened this issue Dec 27, 2024 · 1 comment
Open

'active': 'True' or a 'active': True (bool) needs a review #2593

ReimarBauer opened this issue Dec 27, 2024 · 1 comment
Labels
question Further information is requested

Comments

@ReimarBauer
Copy link
Member

On an old database setup I have seen an error on unarchive of operations. This could also been introduced by 02999a0#diff-a79f98f21772ef2875786e134f047c59410460de657ceda7b4829521ec2a87b8

sqlalchemy.exc.StatementError: (builtins.TypeError) Not a boolean value: 'True'
[SQL: UPDATE operations SET active=? WHERE operations.id = ?]
[parameters: [{'active': 'True', 'operations_id': 9}]]
INFO: disconnected

This needs a test

@ReimarBauer ReimarBauer added the question Further information is requested label Dec 27, 2024
@anj20
Copy link
Contributor

anj20 commented Jan 24, 2025

Hi @ReimarBauer
Can we explicitly check if the string is "True" (case-sensitive or case-insensitive) and then convert it to a boolean, instead of directly converting the value to a boolean? Jst like this

if isinstance(active, bool): self.active = active else: self.active = str(active).strip().lower() == 'true'

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

No branches or pull requests

2 participants