Ticket #2304: 2304.1.diff

File 2304.1.diff, 4.9 KB (added by ramiro, 4 years ago)
  • django/conf/global_settings.py

    diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
    a b  
    398398
    399399# Do you want to manage transactions manually?
    400400# Hint: you really don't!
    401 TRANSACTIONS_MANAGED = False
     401DISABLE_TRANSACTION_MANAGEMENT = False
    402402
    403403# The User-Agent string to use when checking for URL validity through the
    404404# isExistingURL validator.
  • django/db/backends/__init__.py

    diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
    a b  
    9292        if self.transaction_state:
    9393            self.transaction_state.append(self.transaction_state[-1])
    9494        else:
    95             self.transaction_state.append(settings.TRANSACTIONS_MANAGED)
     95            if hasattr(settings, 'TRANSACTIONS_MANAGED'):
     96                warnings.warn(
     97                    'The `TRANSACTIONS_MANAGED` setting is deprecated. '
     98                    'Please update your code to use DISABLE_TRANSACTION_MANAGEMENT.',
     99                    PendingDeprecationWarning
     100                )
     101                self.transaction_state.append(settings.TRANSACTIONS_MANAGED)
     102            else:
     103                self.transaction_state.append(settings.DISABLE_TRANSACTION_MANAGEMENT)
    96104
    97105        if self._dirty is None:
    98106            self._dirty = False
     
    156164        """
    157165        if self.transaction_state:
    158166            return self.transaction_state[-1]
    159         return settings.TRANSACTIONS_MANAGED
     167        if hasattr(settings, 'TRANSACTIONS_MANAGED'):
     168            warnings.warn(
     169                'The `TRANSACTIONS_MANAGED` setting is deprecated. '
     170                'Please update your code to use DISABLE_TRANSACTION_MANAGEMENT.',
     171                PendingDeprecationWarning
     172            )
     173            return settings.TRANSACTIONS_MANAGED
     174        return settings.DISABLE_TRANSACTION_MANAGEMENT
    160175
    161176    def managed(self, flag=True):
    162177        """
  • docs/internals/deprecation.txt

    diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
    a b  
    220220          was deprecated since Django 1.4 and will be removed in favor of the
    221221          generic static files handling.
    222222
     223        * The :setting:`TRANSACTIONS_MANAGED` setting has been deprecated
     224          since Django 1.4 and will be ignored. It has been replaced by
     225          :setting:`DISABLE_TRANSACTION_MANAGEMENT`.
     226
    223227    * 2.0
    224228        * ``django.views.defaults.shortcut()``. This function has been moved
    225229          to ``django.contrib.contenttypes.views.shortcut()`` as part of the
  • docs/ref/settings.txt

    diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
    a b  
    809809Default tablespace to use for models that don't specify one, if the
    810810backend supports it.
    811811
    812 .. setting:: DISALLOWED_USER_AGENTS
     812.. setting:: DISABLE_TRANSACTION_MANAGEMENT
     813
     814DISABLE_TRANSACTION_MANAGEMENT
     815------------------------------
     816
     817.. versionadded:: 1.4
     818
     819Default: ``False``
     820
     821This is a setting whose value is seldomly changed.
     822
     823If you set it to ``True``, Django won't provide any automatic transaction
     824management.  See :ref:`deactivating-db-transaction-management` for more details.
     825
     826Before Django 1.4 the name of this setting was ``TRANSACTIONS_MANAGED``.
    813827
    814828DISALLOWED_USER_AGENTS
    815829----------------------
     
    21482162.. deprecated:: 1.2
    21492163   This setting has been replaced by :setting:`TEST_NAME` in
    21502164   :setting:`DATABASES`.
     2165
     2166.. setting:: TRANSACTIONS_MANAGED
     2167
     2168TRANSACTIONS_MANAGED
     2169--------------------
     2170
     2171.. deprecated:: 1.4
     2172   This setting has been replaced by :setting:`DISABLE_TRANSACTION_MANAGEMENT`.
  • docs/releases/1.4.txt

    diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt
    a b  
    489489
    490490The existence of any ``'filters'`` key under the ``'mail_admins'`` handler will
    491491disable this backward-compatibility shim and deprecation warning.
     492
     493``TRANSACTIONS_MANAGED`` setting
     494~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     495
     496This setting has been replaced by the :setting:`DISABLE_TRANSACTION_MANAGEMENT`
     497setting. Both settings have the same default values and semantics.
     498
  • docs/topics/db/transactions.txt

    diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt
    a b  
    204204if your transaction only reads from the database, the transaction must
    205205be committed or rolled back before you complete a request.
    206206
     207.. _deactivating-db-transaction-management:
     208
    207209How to globally deactivate transaction management
    208210=================================================
    209211
    210212Control freaks can totally disable all transaction management by setting
    211 ``DISABLE_TRANSACTION_MANAGEMENT`` to ``True`` in the Django settings file.
     213:setting:`DISABLE_TRANSACTION_MANAGEMENT` to ``True`` in the Django settings
     214file.
    212215
    213216If you do this, Django won't provide any automatic transaction management
    214217whatsoever. Middleware will no longer implicitly commit transactions, and
Back to Top