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