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
a5c8072a
Kaydet (Commit)
a5c8072a
authored
May 17, 2016
tarafından
Barthelemy Dagenais
Kaydeden (comit)
Tim Graham
May 18, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26627 -- Fixed on_commit callbacks execution order when callbacks make transactions.
üst
4ff1e6ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
base.py
django/db/backends/base/base.py
+5
-6
1.9.7.txt
docs/releases/1.9.7.txt
+3
-0
tests.py
tests/transaction_hooks/tests.py
+14
-0
No files found.
django/db/backends/base/base.py
Dosyayı görüntüle @
a5c8072a
...
...
@@ -617,12 +617,11 @@ class BaseDatabaseWrapper(object):
def
run_and_clear_commit_hooks
(
self
):
self
.
validate_no_atomic_block
()
try
:
while
self
.
run_on_commit
:
sids
,
func
=
self
.
run_on_commit
.
pop
(
0
)
func
()
finally
:
self
.
run_on_commit
=
[]
current_run_on_commit
=
self
.
run_on_commit
self
.
run_on_commit
=
[]
while
current_run_on_commit
:
sids
,
func
=
current_run_on_commit
.
pop
(
0
)
func
()
def
copy
(
self
,
alias
=
None
,
allow_thread_sharing
=
None
):
"""
...
...
docs/releases/1.9.7.txt
Dosyayı görüntüle @
a5c8072a
...
...
@@ -17,3 +17,6 @@ Bugfixes
* Fixed a regression causing the cached template loader to crash when using
lazy template names (:ticket:`26603`).
* Fixed ``on_commit`` callbacks execution order when callbacks make
transactions (:ticket:`26627`).
tests/transaction_hooks/tests.py
Dosyayı görüntüle @
a5c8072a
...
...
@@ -208,6 +208,20 @@ class TestConnectionOnCommit(TransactionTestCase):
self
.
assertDone
([
1
])
def
test_hook_in_hook
(
self
):
def
on_commit
(
i
,
add_hook
):
with
transaction
.
atomic
():
if
add_hook
:
transaction
.
on_commit
(
lambda
:
on_commit
(
i
+
10
,
False
))
t
=
Thing
.
objects
.
create
(
num
=
i
)
self
.
notify
(
t
.
num
)
with
transaction
.
atomic
():
transaction
.
on_commit
(
lambda
:
on_commit
(
1
,
True
))
transaction
.
on_commit
(
lambda
:
on_commit
(
2
,
True
))
self
.
assertDone
([
1
,
11
,
2
,
12
])
def
test_raises_exception_non_autocommit_mode
(
self
):
def
should_never_be_called
():
raise
AssertionError
(
'this function should never be called'
)
...
...
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