Replace on_success_commit with atomic
authorMagnus Hagander <magnus@hagander.net>
Wed, 6 Jan 2016 15:34:50 +0000 (16:34 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 6 Jan 2016 15:34:50 +0000 (16:34 +0100)
pgcommitfest/commitfest/ajax.py
pgcommitfest/commitfest/views.py
pgcommitfest/userprofile/views.py

index 1adf0d0e764934c527a1765fa64a097e14374876..96ae7b02e6607d6f58c8b5bedd66ef68187cefc7 100644 (file)
@@ -73,7 +73,7 @@ def getMessages(request):
        r = _archivesAPI('/message-id.json/%s' % thread.messageid)
        return sorted(r, key=lambda x: x['date'], reverse=True)
 
-@transaction.commit_on_success
+@transaction.atomic
 def annotateMessage(request):
        thread = get_object_or_404(MailThread, pk=int(request.POST['t']))
        msgid = request.POST['msgid']
@@ -102,7 +102,7 @@ def annotateMessage(request):
                        return 'OK'
        return 'Message not found in thread!'
 
-@transaction.commit_on_success
+@transaction.atomic
 def deleteAnnotation(request):
        annotation = get_object_or_404(MailThreadAnnotation, pk=request.POST['id'])
 
@@ -132,7 +132,7 @@ def parse_and_add_attachments(threadinfo, mailthread):
                # In theory we should remove objects if they don't have an
                # attachment, but how could that ever happen? Ignore for now.
 
-@transaction.commit_on_success
+@transaction.atomic
 def attachThread(request):
        cf = get_object_or_404(CommitFest, pk=int(request.POST['cf']))
        patch = get_object_or_404(Patch, pk=int(request.POST['p']), commitfests=cf)
@@ -185,7 +185,7 @@ def doAttachThread(cf, patch, msgid, user):
 
        return 'OK'
 
-@transaction.commit_on_success
+@transaction.atomic
 def detachThread(request):
        cf = get_object_or_404(CommitFest, pk=int(request.POST['cf']))
        patch = get_object_or_404(Patch, pk=int(request.POST['p']), commitfests=cf)
index f2e54d2628a1d2dcedb564eaae4b28981f28b050..b4f19b2db470e5269943418b2402ca9ddfff0dff 100644 (file)
@@ -228,7 +228,7 @@ def patch(request, cfid, patchid):
                }, context_instance=RequestContext(request))
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def patchform(request, cfid, patchid):
        cf = get_object_or_404(CommitFest, pk=cfid)
        patch = get_object_or_404(Patch, pk=patchid, commitfests=cf)
@@ -262,7 +262,7 @@ def patchform(request, cfid, patchid):
        }, context_instance=RequestContext(request))
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def newpatch(request, cfid):
        cf = get_object_or_404(CommitFest, pk=cfid)
        if not cf.status == CommitFest.STATUS_OPEN and not request.user.is_staff:
@@ -312,7 +312,7 @@ def _review_status_string(reviewstatus):
                return "not tested"
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def comment(request, cfid, patchid, what):
        cf = get_object_or_404(CommitFest, pk=cfid)
        patch = get_object_or_404(Patch, pk=patchid)
@@ -396,7 +396,7 @@ def comment(request, cfid, patchid, what):
        }, context_instance=RequestContext(request))
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def status(request, cfid, patchid, status):
        poc = get_object_or_404(PatchOnCommitFest.objects.select_related(), commitfest__id=cfid, patch__id=patchid)
 
@@ -431,7 +431,7 @@ def status(request, cfid, patchid, status):
 
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def close(request, cfid, patchid, status):
        poc = get_object_or_404(PatchOnCommitFest.objects.select_related(), commitfest__id=cfid, patch__id=patchid)
 
@@ -504,7 +504,7 @@ def close(request, cfid, patchid, status):
        return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def reviewer(request, cfid, patchid, status):
        get_object_or_404(CommitFest, pk=cfid)
        patch = get_object_or_404(Patch, pk=patchid)
@@ -522,7 +522,7 @@ def reviewer(request, cfid, patchid, status):
        return HttpResponseRedirect('../../')
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def committer(request, cfid, patchid, status):
        get_object_or_404(CommitFest, pk=cfid)
        patch = get_object_or_404(Patch, pk=patchid)
@@ -546,7 +546,7 @@ def committer(request, cfid, patchid, status):
        return HttpResponseRedirect('../../')
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def send_email(request, cfid):
        cf = get_object_or_404(CommitFest, pk=cfid)
        if not request.user.is_staff:
index 75e84c823fbfbef27fec3b08343968c0ee5e32bf..7dac00c6114e71d568518de41f47f6539dff6c89 100644 (file)
@@ -15,7 +15,7 @@ from forms import UserProfileForm, MailForm
 from util import generate_random_token
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def userprofile(request):
        (profile, created) = UserProfile.objects.get_or_create(user=request.user)
        form = mailform = None
@@ -62,7 +62,7 @@ def userprofile(request):
                }, context_instance=RequestContext(request))
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def deletemail(request):
        try:
                id = int(request.META['QUERY_STRING'])
@@ -81,7 +81,7 @@ def deletemail(request):
        return HttpResponseRedirect('../')
 
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def confirmemail(request, tokenhash):
        try:
                e = UserExtraEmail.objects.get(user=request.user, token=tokenhash)