save snapshot

This commit is contained in:
Cayo Puigdefabregas 2022-03-17 18:52:58 +01:00
parent 8d3cad48bf
commit 6bad17013d
1 changed files with 2 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import json
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from boltons.urlutils import URL from boltons.urlutils import URL
from flask import current_app as app
from flask import g, request from flask import g, request
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from sqlalchemy import or_ from sqlalchemy import or_
@ -234,12 +235,9 @@ class UploadSnapshotForm(FlaskForm):
def save(self, commit=True): def save(self, commit=True):
if any([x == 'Error' for x in self.result.values()]): if any([x == 'Error' for x in self.result.values()]):
return return
# result = []
self.sync = Sync() self.sync = Sync()
schema = SnapshotSchema() schema = SnapshotSchema()
# self.tmp_snapshots = app.config['TMP_SNAPSHOTS'] self.tmp_snapshots = app.config['TMP_SNAPSHOTS']
# TODO @cayop get correct var config
self.tmp_snapshots = '/tmp/'
for filename, snapshot_json in self.snapshots: for filename, snapshot_json in self.snapshots:
path_snapshot = save_json(snapshot_json, self.tmp_snapshots, g.user.email) path_snapshot = save_json(snapshot_json, self.tmp_snapshots, g.user.email)
snapshot_json.pop('debug', None) snapshot_json.pop('debug', None)