skip to navigation
skip to content

Not Logged In

django-atomic-signals 1.0.0

Signals for atomic transaction blocks in Django 1.6+

https://travis-ci.org/nickbruun/django_atomic_signals.png?branch=master

By default, Django does not provide signals for when a database transaction is entered or left. As per various Django tickets, there seems to be no interest in adding this, which has led to a variety of third party solutions. However, due to the changes to transaction handling in Django 1.6, these solutions are no longer functional.

django_atomic_signals provides a Django 1.6 compatible approach to transaction signals through a monkey patching of the django.db.transactions.Atomic context manager.

Installation

To install django_atomic_signals, do yourself a favor and don't use anything other than pip:

$ pip install django_atomic_signals

Add django_atomic_signals to the list of installed apps in your settings file:

INSTALLED_APPS = (
    'django_atomic_signals',
    ..
)

Usage

django_atomic_signals provides four signals for applications to use:

django_atomic_signals.pre_enter_atomic_block

Emitted prior to attempting to enter an atomic transaction block.

Parameters:
  • using -- Database alias being used for the transaction.
  • outermost -- Boolean value indicating whether or not the transaction is the outermost transaction, ie. if the transaction will be effectively committed once the transaction is successfully exited.
  • savepoint -- Boolean value indicating whether or not the atomic block is a savepoint, ie. if the transaction causes a savepoint to be created.
django_atomic_signals.post_enter_atomic_block

Emitted after an atomic transaction block has been entered.

Parameters:
  • using -- Database alias being used for the transaction.
  • outermost -- Boolean value indicating whether or not the transaction is the outermost transaction, ie. if the transaction will be effectively committed once the transaction is successfully exited.
  • savepoint -- Boolean value indicating whether or not the atomic block is a savepoint, ie. if the transaction causes a savepoint to be created.
django_atomic_signals.pre_exit_atomic_block

Emitted prior to attempting to exit an atomic transaction block.

Parameters:
  • using -- Database alias being used for the transaction.
  • outermost -- Boolean value indicating whether or not the transaction is the outermost transaction, ie. if the transaction will be effectively committed once the transaction is successfully exited.
  • savepoint -- Boolean value indicating whether or not the atomic block is a savepoint, ie. if the transaction causes a savepoint to be created.
  • successful -- Boolean value indicating whether or not the database actions within the transaction block were successful.
django_atomic_signals.post_exit_atomic_block

Emitted after an atomic transaction block has been exited.

Parameters:
  • using -- Database alias being used for the transaction.
  • outermost -- Boolean value indicating whether or not the transaction is the outermost transaction, ie. if the transaction will be effectively committed once the transaction is successfully exited.
  • savepoint -- Boolean value indicating whether or not the atomic block is a savepoint, ie. if the transaction causes a savepoint to be created.
  • successful -- Boolean value indicating whether or not the database actions within the transaction block as well as the attempt to commit the changes to the database were successful.
 
File Type Py Version Uploaded on Size
django-atomic-signals-1.0.0.tar.gz (md5) Source 2014-01-13 3KB
  • Downloads (All Versions):
  • 57 downloads in the last day
  • 239 downloads in the last week
  • 411 downloads in the last month
  • Author: Nick Bruun
  • Home Page: http://bruun.co/
  • License:
    Copyright (c) Nick Bruun <nick@bruun.co>
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:
    
        1. Redistributions of source code must retain the above copyright notice, 
           this list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright 
           notice, this list of conditions and the following disclaimer in the
           documentation and/or other materials provided with the distribution.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    
    Parts of the code base are derivatives of the Django code base subject to the
    Django license:
    
    Copyright (c) Django Software Foundation and individual contributors.
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:
    
        1. Redistributions of source code must retain the above copyright notice, 
           this list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright 
           notice, this list of conditions and the following disclaimer in the
           documentation and/or other materials provided with the distribution.
    
        3. Neither the name of Django nor the names of its contributors may be used
           to endorse or promote products derived from this software without
           specific prior written permission.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Package Index Owner: bruun
  • DOAP record: django-atomic-signals-1.0.0.xml