#21004 closed Cleanup/optimization (wontfix)
Deprecation Timeline: is_managed(): more info needed
Reported by: | Thomas Güttler | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to the Deprecation Timeline is_manged() and some other APIs get removed:
https://docs.djangoproject.com/en/dev/internals/deprecation/#id5
The following private APIs will be removed: ...
Please provide a link or more info how to update source code.
The django users should know how to use is_managed() with future versions.
Change History (5)
comment:1 by , 11 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
The django users should know how to use is_managed() with future versions.
The answer is very simple: don't, it's going to be removed.
comment:3 by , 10 years ago
comment:4 by , 10 years ago
You can use this, instead of is_managed()
transaction.get_connection().in_atomic_block
comment:5 by , 10 years ago
Indeed you can keep using private APIs if you like pain.
Or you can take advantage of the new public APIs like I said above:
You'll probably end up replacing it by
not transaction.get_autocommit()
.
It's a private API. If you've been using it, you're on your own; that's the deal.
In Django 1.6 you cannot put a connection in managed mode, so
is_managed()
always returnsFalse
. You'll probably end up replacing it bynot transaction.get_autocommit()
. But more generally you need to account for the new transaction management, which means you need to understand what your code is trying to achieve and what functionality the new transaction management API provides rather than just replaceis_managed()
by something else.I can suggest two resources:
FYI I didn't remove the API outright because I knew it was used into the wild. I made an extra effort to provide a deprecation path. However, that's the extent of what I'm willing to do. Since it's a private API, its purpose and use case weren't documented, and therefore I cannot provide adequate advice in general.