Here are the examples of the python api django.db._rollback_on_exception taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
Example 1
Project: google-app-engine-django Source File: __init__.py
def InstallDjangoModuleReplacements():
"""Replaces internal Django modules with App Engine compatible versions."""
# Replace the session module with a partial replacement overlay using
# __path__ so that portions not replaced will fall through to the original
# implementation.
try:
from django.contrib import sessions
orig_path = sessions.__path__[0]
sessions.__path__.insert(0, os.path.join(DIR_PATH, 'sessions'))
from django.contrib.sessions import backends
backends.__path__.append(os.path.join(orig_path, 'backends'))
except ImportError:
logging.debug("No Django session support available")
# Replace incompatible dispatchers.
import django.core.signals
import django.db
import django.dispatch.dispatcher
# Rollback occurs automatically on Google App Engine. Disable the Django
# rollback handler.
try:
# pre 1.0
from django.dispatch import errors
CheckedException = errors.DispatcherKeyError
def _disconnectSignal():
django.dispatch.dispatcher.disconnect(
django.db._rollback_on_exception,
django.core.signals.got_request_exception)
except ImportError:
CheckedException = KeyError
def _disconnectSignal():
django.core.signals.got_request_exception.disconnect(
django.db._rollback_on_exception)
try:
_disconnectSignal()
except CheckedException, e:
logging.debug("Django rollback handler appears to be already disabled.")
0
Example 2
Project: geraldo Source File: __init__.py
def InstallDjangoModuleReplacements():
"""Replaces internal Django modules with App Engine compatible versions."""
# Replace the session module with a partial replacement overlay using
# __path__ so that portions not replaced will fall through to the original
# implementation.
try:
from django.contrib import sessions
orig_path = sessions.__path__[0]
sessions.__path__.insert(0, os.path.join(DIR_PATH, 'sessions'))
from django.contrib.sessions import backends
backends.__path__.append(os.path.join(orig_path, 'backends'))
except ImportError:
logging.debug("No Django session support available")
# Replace incompatible dispatchers.
import django.core.signals
import django.db
import django.dispatch.dispatcher
# Rollback occurs automatically on Google App Engine. Disable the Django
# rollback handler.
try:
# pre 1.0
from django.dispatch import errors
CheckedException = errors.DispatcherKeyError
def _disconnectSignal():
django.dispatch.dispatcher.disconnect(
django.db._rollback_on_exception,
django.core.signals.got_request_exception)
except ImportError:
CheckedException = KeyError
def _disconnectSignal():
django.core.signals.got_request_exception.disconnect(
django.db._rollback_on_exception)
try:
_disconnectSignal()
except CheckedException, e:
logging.debug("Django rollback handler appears to be already disabled.")