Ticket #2304: fixed_transaction_settings_variable_name.diff

File fixed_transaction_settings_variable_name.diff, 2.1 KB (added by tjshewmake, 14 years ago)

Proposed fix of manual transactions variable name.

  • db/transaction.py

     
    6161        state[thread_ident][using].append(state[thread_ident][using][-1])
    6262    else:
    6363        state.setdefault(thread_ident, {})
    64         state[thread_ident][using] = [settings.TRANSACTIONS_MANAGED]
     64        if hasattr(settings, 'TRANSACTIONS_MANAGED'):
     65            state[thread_ident][using] = [settings.TRANSACTIONS_MANAGED]
     66            warnings.warn(
     67                '`settings.TRANSACTIONS_MANAGED` is deprecated. '
     68                'Please update your code to use DISABLE_TRANSACTION_MANAGEMENT.',
     69                PendingDeprecationWarning
     70            )
     71        else:
     72            state[thread_ident][using] = [settings.DISABLE_TRANSACTION_MANAGEMENT]
     73
    6574    if thread_ident not in dirty or using not in dirty[thread_ident]:
    6675        dirty.setdefault(thread_ident, {})
    6776        dirty[thread_ident][using] = False
     
    142151    if thread_ident in state and using in state[thread_ident]:
    143152        if state[thread_ident][using]:
    144153            return state[thread_ident][using][-1]
    145     return settings.TRANSACTIONS_MANAGED
     154    if hasattr(settings, 'TRANSACTIONS_MANAGED'):
     155        warnings.warn(
     156            '`settings.TRANSACTIONS_MANAGED` is deprecated. '
     157            'Please update your code to use DISABLE_TRANSACTION_MANAGEMENT.',
     158            PendingDeprecationWarning
     159        )
     160        return settings.TRANSACTIONS_MANAGED
     161    else:
     162        return settings.DISABLE_TRANSACTION_MANAGEMENT
    146163
    147164def managed(flag=True, using=None):
    148165    """
  • conf/global_settings.py

     
    378378
    379379# Do you want to manage transactions manually?
    380380# Hint: you really don't!
    381 TRANSACTIONS_MANAGED = False
     381DISABLE_TRANSACTION_MANAGEMENT = False
    382382
    383383# The User-Agent string to use when checking for URL validity through the
    384384# isExistingURL validator.
Back to Top