-
Notifications
You must be signed in to change notification settings - Fork 150
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
Update utils.py #225
Update utils.py #225
Conversation
verify get_meta isn't none before requesting db_table
Can you add a test and fix CI? |
If I'm reading the CI issue correctly, though, it looks like errors keep getting generated because of a missing password for the DB. That seems like a separate problem unrelated to this patch? It's very possible I'm not reading this correctly. psycopg2.OperationalError: fe_sendauth: no password supplied |
@hho6643 I've fixed the CI errors. Would be great to get a test written here if your time permits. Thanks again! |
Pull Request Test Coverage Report for Build 4383434952
💛 - Coveralls |
Hah, I finally got around today to start working on a test and it's already done! |
verify get_meta isn't none before requesting db_table
Description
Patch to check that "query.get_meta()" is not None before getting db_table attribue.
Rationale
Using:
Django: 4.1.6
django-cachalot: 2.5.2
psycopg2: 2.9.5
During Model.validate_constraints() on new object save, I'm getting an "AttributeError" exception in _get_tables of utils.py at:
tables.add(query.get_meta().db_table); specifically when checking a FloatField constraint is greater than 0.
The issue is query.get_meta() is returning None, which doesn't have a db_table attribute. This patch checks for None before getting db_table.
The issue does not occur on Django 4.0.9.