Skip to content

Replace DatabaseWrapper.__getattr__() with a simpler database attribute #287

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

timgraham
Copy link
Collaborator

No description provided.

I contemplated removing the self.database assignment from
DatabaseWrapper.init_connection_state() which would have broken this.
Copy link
Contributor

@Jibola Jibola left a comment

Choose a reason for hiding this comment

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

LGTM. Non-blocking questions

Comment on lines +35 to +36
connection_created.connect(receiver)
connection.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also assert that data is empty after calling close() or is that not necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Certainly could, but if close() actually created a connection (thus firing the connection_created signal) instead of closing, I think there would be other rather obvious problems.

Comment on lines -157 to -158
return getattr(self, attr)
raise AttributeError(attr)
Copy link
Contributor

Choose a reason for hiding this comment

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

So we now won't raise an error if something other than database is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default implementation of __getattr__() raises AttributeError.

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