]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Write profiles in one transaction
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2017 12:15:46 +0000 (13:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2017 12:15:46 +0000 (13:15 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
webapp/handlers_fireinfo.py

index f35c187a52149a40e1ccf4e7878148af98b95b74..bc3d102f59a93f8d45a081a978d3fdb95e8e8dd1 100644 (file)
@@ -156,11 +156,12 @@ class FireinfoProfileSendHandler(FireinfoBaseHandler):
                        location = location.country
 
                # Handle the profile.
-               try:
-                       self.fireinfo.handle_profile(public_id, profile_blob, location=location)
+                with self.db.transaction():
+                        try:
+                                self.fireinfo.handle_profile(public_id, profile_blob, location=location)
 
-               except backend.fireinfo.ProfileParserError:
-                       raise tornado.web.HTTPError(400)
+                        except backend.fireinfo.ProfileParserError:
+                                raise tornado.web.HTTPError(400)
 
                self.finish("Your profile was successfully saved to the database.")