|
|
@ -84,14 +84,14 @@ def get_distribusi_file_forms(distribusi_id): |
|
|
|
|
|
|
|
|
|
|
|
def save_described_file_to_db(describe_form, distribusi_file): |
|
|
|
if describe_form.validate_on_submit(): |
|
|
|
try: |
|
|
|
if describe_form.description.data: |
|
|
|
distribusi_file.description = describe_form.description |
|
|
|
print(distribusi_file.id) |
|
|
|
distribusi_file.description = describe_form.description.data |
|
|
|
if describe_form.alttext.data: |
|
|
|
distribusi_file.alttext = describe_form.alttext |
|
|
|
distribusi_file.alttext = describe_form.alttext.data |
|
|
|
if describe_form.searchtags.data: |
|
|
|
distribusi_file.tags = describe_form.searchtags |
|
|
|
distribusi_file.tags = describe_form.searchtags.data |
|
|
|
db.session.add(distribusi_file) |
|
|
|
db.session.commit() |
|
|
|
except (InvalidRequestError, IntegrityError): |
|
|
@ -104,13 +104,9 @@ def save_described_file_to_db(describe_form, distribusi_file): |
|
|
|
flash("Invalid Entry", "warning") |
|
|
|
except InterfaceError: |
|
|
|
db.session.rollback() |
|
|
|
describe_form.save.errors.append( |
|
|
|
"Error connecting to the database" |
|
|
|
) |
|
|
|
describe_form.save.errors.append("Error connecting to the database") |
|
|
|
flash("Error connecting to the database", "danger") |
|
|
|
except DatabaseError: |
|
|
|
db.session.rollback() |
|
|
|
describe_form.save.errors.append( |
|
|
|
"Error connecting to the database" |
|
|
|
) |
|
|
|
describe_form.save.errors.append("Error connecting to the database") |
|
|
|
flash("Error connecting to the database", "danger") |
|
|
|