From: Michael Tremer Date: Wed, 1 Nov 2017 12:15:46 +0000 (+0100) Subject: fireinfo: Write profiles in one transaction X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f726def6a5afe185318a39a4ad10b667ea77bf2e;p=ipfire.org.git fireinfo: Write profiles in one transaction Signed-off-by: Michael Tremer --- diff --git a/webapp/handlers_fireinfo.py b/webapp/handlers_fireinfo.py index f35c187a..bc3d102f 100644 --- a/webapp/handlers_fireinfo.py +++ b/webapp/handlers_fireinfo.py @@ -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.")