def teardown_request(exception): if exception is not None: db.rollback() db.close()
ts = data["ts"] # Get the remote IP address. The downloads will have # a remote_addr already, so don't add it if the key # exists if "remote_addr" not in data: data["remote_addr"] = request.environ["REMOTE_ADDR"] remote_addr = data["remote_addr"] # Store the raw data try: data["id"] = db.store_raw_data(ts, remote_addr, data) db.commit() except Exception, e: log.error("Error storing JSON data: %s", e) db.rollback() return "Error storing JSON data", 500 # Store the processed data try: loader.process_raw_data(data) db.commit() except Exception, e: log.error("Error processing JSON data: %s", e) db.rollback() return "", 202 def __get_datatables_args(): '''