|
@ -94,14 +94,10 @@ def save_described_file_to_db(describe_form, distribusi_file): |
|
|
distribusi_file.tags = describe_form.searchtags |
|
|
distribusi_file.tags = describe_form.searchtags |
|
|
db.session.add(distribusi_file) |
|
|
db.session.add(distribusi_file) |
|
|
db.session.commit() |
|
|
db.session.commit() |
|
|
except InvalidRequestError: |
|
|
except (InvalidRequestError, IntegrityError): |
|
|
db.session.rollback() |
|
|
db.session.rollback() |
|
|
describe_form.save.errors.append("Something went wrong!") |
|
|
describe_form.save.errors.append("Something went wrong!") |
|
|
flash("Something went wrong!", "danger") |
|
|
flash("Something went wrong!", "danger") |
|
|
except IntegrityError: |
|
|
|
|
|
db.session.rollback() |
|
|
|
|
|
describe_form.save.errors.append("User already exists!") |
|
|
|
|
|
flash("User already exists!", "warning") |
|
|
|
|
|
except DataError: |
|
|
except DataError: |
|
|
db.session.rollback() |
|
|
db.session.rollback() |
|
|
describe_form.save.errors.append("Invalid Entry") |
|
|
describe_form.save.errors.append("Invalid Entry") |
|
|