Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
f7245b83
Kaydet (Commit)
f7245b83
authored
Mar 07, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implemented atomic_if_autocommit.
It disables transaction management entirely when AUTOCOMMIT is False.
üst
09ba70f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
transaction.py
django/db/transaction.py
+22
-4
No files found.
django/db/transaction.py
Dosyayı görüntüle @
f7245b83
...
...
@@ -308,6 +308,24 @@ def atomic(using=None):
return
Atomic
(
using
)
def
atomic_if_autocommit
(
using
=
None
):
# This variant only exists to support the ability to disable transaction
# management entirely in the DATABASES setting. It doesn't care about the
# autocommit state at run time.
db
=
DEFAULT_DB_ALIAS
if
callable
(
using
)
else
using
autocommit
=
get_connection
(
db
)
.
settings_dict
[
'AUTOCOMMIT'
]
if
autocommit
:
return
atomic
(
using
)
else
:
# Bare decorator: @atomic_if_autocommit
if
callable
(
using
):
return
using
# Decorator: @atomic_if_autocommit(...)
else
:
return
lambda
func
:
func
############################################
# Deprecated decorators / context managers #
############################################
...
...
@@ -431,13 +449,13 @@ def commit_on_success_unless_managed(using=None):
Transitory API to preserve backwards-compatibility while refactoring.
Once the legacy transaction management is fully deprecated, this should
simply be replaced by atomic
. Until then, it's necessary to avoid making a
commit where Django didn't use to, since entering atomic in managed mode
triggers a commmit.
simply be replaced by atomic
_if_autocommit. Until then, it's necessary to
avoid making a commit where Django didn't use to, since entering atomic in
managed mode
triggers a commmit.
"""
connection
=
get_connection
(
using
)
if
connection
.
autocommit
or
connection
.
in_atomic_block
:
return
atomic
(
using
)
return
atomic
_if_autocommit
(
using
)
else
:
def
entering
(
using
):
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment