-
Notifications
You must be signed in to change notification settings - Fork 19
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
Noisy errors on startup #24
Comments
Hey @sondrelg On top of my head, could it make sense to display the call stack trace? Maybe through an option, so that one can get a better understanding from where the access comes from. |
That helped 🥇 Thanks! This is the culprit: https://github.com/viewflow/django-fsm/blob/master/django_fsm/__init__.py#L436 This library method is triggered by a django signal that's fired on startup (and is supposed to AFAICT), from here: https://github.com/django/django/blob/main/django/db/models/base.py#L428 |
That's indeed hard to catch 🙈 Should |
I was thinking more along the lines of just not outputting the warning in these cases. The purpose of the warning is to avoid calls to deprecated fields right? This isn't that, so maybe the warning isn't necessary? What do you think? |
Yes indeed.
It isn't? It's still a call to the deprecate field. |
What I mean is, it's a call to the field, but with this type of implementation:
This is psuedo-code, but my point would be that this would trigger the warning even though the operation is harmless (and unavoidable). So my thinking is that this would be ok not to warn about on the basis that there's no direct invocation of an unused field - it's just a mapping operation happening on a model that happens to contain a deprecated field. Do you see it differently? |
I agree that it's probably a case that doesn't require warning. How would the library be able to know if the call if explicit on the field, or implicit because we iterate over all fields 🤔 |
Yeah true 🤔 The simplest fix for my case would be to inspect the stack and check for Then again, this code isn't meant to run very often, so maybe something alone those lines would be acceptable? |
Same issue as #19 |
Hi 👋
Since implementing
deprecate_field
we've started seeing this output whenever we initialize django:After a lot of digging I have not been able to get to the bottom of exactly where our deprecated field is called, but it seems to be indirect. There are no direct calls to the deprecated field anywhere.
Would you accept a PR where we change the default behavior to only outputting this if either the class name or object name is known?
The text was updated successfully, but these errors were encountered: