Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#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 Aymeric Augustin, 11 years ago

Resolution: wontfix
Status: newclosed

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 returns False. You'll probably end up replacing it by not 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 replace is_managed() by something else.

I can suggest two resources:

  • my talk at DjangoCon in Warsaw gives lots of background on the design of transaction management in Django (both the old one and the new one) — see http://myks.org/en/talks/
  • the transaction management docs contain fairly extensive information about upgrading.

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.

comment:2 by Aymeric Augustin, 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:4 by Thomas Güttler, 10 years ago

You can use this, instead of is_managed()

transaction.get_connection().in_atomic_block

comment:5 by Aymeric Augustin, 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().

Version 0, edited 10 years ago by Aymeric Augustin (next)
Note: See TracTickets for help on using tickets.
Back to Top