Bugfix: variable definition for different actions
This commit is contained in:
parent
72f2af1df8
commit
2bf0eeb33d
@ -80,10 +80,8 @@ def _submit_quiz():
|
||||
def _editor(id:str=None):
|
||||
request_data = request.get_json()
|
||||
id = request_data['id']
|
||||
try:
|
||||
dataset = Dataset.query.filter_by(id=id).first()
|
||||
user = User.query.filter_by(id=creator).first()
|
||||
except SQLAlchemyError as exception:
|
||||
try: dataset = Dataset.query.filter_by(id=id).first()
|
||||
except (SQLAlchemyError, ConnectionError) as exception:
|
||||
write('system.log', f'Database error when processing request \'{request.url}\': {exception}')
|
||||
return abort(500)
|
||||
if not dataset: return jsonify({'error': 'Invalid request. Dataset not found.'}), 404
|
||||
@ -94,6 +92,10 @@ def _editor(id:str=None):
|
||||
return jsonify({'success': 'Successfully downloaded dataset', 'data': data}), 200
|
||||
default = request_data['default']
|
||||
creator = request_data['creator']
|
||||
try: user = User.query.filter_by(id=creator).first()
|
||||
except (SQLAlchemyError, ConnectionError) as exception:
|
||||
write('system.log', f'Database error when processing request \'{request.url}\': {exception}')
|
||||
return abort(500)
|
||||
name = request_data['name']
|
||||
data = request_data['data']
|
||||
if not validate_json(data): return jsonify({'error': 'The data you submitted was invalid.'}), 400
|
||||
|
Loading…
Reference in New Issue
Block a user