Update for new transaction handling in newer django versions
authorMagnus Hagander <magnus@hagander.net>
Thu, 28 Apr 2016 09:31:25 +0000 (11:31 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sat, 14 May 2016 17:49:12 +0000 (19:49 +0200)
pgweb/account/views.py
pgweb/core/views.py
pgweb/downloads/views.py
pgweb/survey/views.py

index 40122425163dae2255840f72d5128bf16e614bb4..44f23cbae3fe367b348ccdec90ae364d08af99ed 100644 (file)
@@ -80,7 +80,7 @@ objtypes = {
 
 @ssl_required
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def profile(request):
        # We always have the user, but not always the profile. And we need a bit
        # of a hack around the normal forms code since we have two different
@@ -124,7 +124,7 @@ def profile(request):
 
 @ssl_required
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def change_email(request):
        tokens = EmailChangeToken.objects.filter(user=request.user)
        token = len(tokens) and tokens[0] or None
@@ -159,7 +159,7 @@ def change_email(request):
 
 @ssl_required
 @login_required
-@transaction.commit_on_success
+@transaction.atomic
 def confirm_change_email(request, tokenhash):
        tokens = EmailChangeToken.objects.filter(user=request.user, token=tokenhash)
        token = len(tokens) and tokens[0] or None
index fb2a9396a9026936a4ff170b5bd104ff9bc64518..1ceafd23823d4206e88da18215fa4e50789ae0eb 100644 (file)
@@ -266,7 +266,6 @@ def admin_purge(request):
                if url == '':
                        return HttpResponseRedirect('.')
                varnish_purge(url)
-               transaction.commit_unless_managed()
                messages.info(request, "Purge completed: '^%s'" % url)
                return HttpResponseRedirect('.')
 
@@ -291,7 +290,6 @@ def api_varnish_purge(request):
        for i in range(0, n):
                expr = request.POST['p%s' % i]
                curs.execute("SELECT varnish_purge_expr(%s)", (expr, ))
-       transaction.commit_unless_managed()
        return HttpResponse("Purged %s entries\n" % n)
 
 @nocache
@@ -306,7 +304,7 @@ def api_repo_updated(request):
 # Merge two organisations
 @login_required
 @user_passes_test(lambda u: u.is_superuser)
-@transaction.commit_on_success
+@transaction.atomic
 def admin_mergeorg(request):
        if request.method == 'POST':
                form = MergeOrgsForm(data=request.POST)
index 50f9211069586bfc89380f225d607e01bdc66a47..e51f3eb38d6f0eae0f5339ce2ebd8e7e0edaa2f7 100644 (file)
@@ -121,7 +121,6 @@ def uploadftp(request):
 
        # Purge it out of varnish so we start responding right away
        varnish_purge("/ftp")
-       transaction.commit_unless_managed()
 
        # Finally, indicate to the client that we're happy
        return HttpResponse("OK", content_type="text/plain")
index 991801ac1dd9f2195f6710c489cfc9ada91da341..05c8d18b1720fc41304e70568c6da807ad6abd82 100644 (file)
@@ -58,7 +58,6 @@ def vote(request, surveyid):
        # do it properly. Possibly because of the cute stuff we do with
        # getattr/setattr above.
        varnish_purge("/community/survey/%s/" % surveyid)
-       transaction.commit_unless_managed()
 
        return HttpResponseRedirect("/community/survey/%s/" % surveyid)