Please select the category that most closely reflects your concern about the presentation, so that we can review it and determine whether it violates our Terms of Use or isn't appropriate for all viewers.
ちょっとハマったのでメモしておく。 commit_on_successデコレータは、その名の通り関数が成功したらコミットする。その関数の開始時にトランザクションを開始したりはしない。既存のコネクションがあればそれを利用する。したがって、commit_on_successデコレータをネストさせても、意図したようには動かない。ネストした関数が失敗すると、ネストする前に行ったDB操作も一緒にロールバックされる。きちんとソース読んで、それでもわからないなら実際にコード書かないと駄目だな・・・ 次のコードだと、test_rollback_nestedだけテストにパスしない。 # -*- encoding: utf-8 -*- from django.db import models from django.db import transaction class Person(models.Model
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く