redo Status SetMessage so it defaults to success and danger is a force in the setting of the message, to fix BUG-52 where a success message ended up with danger colour somehow -- might not perfectly fix it, but its neater and if it does not fix it, then its a timing issue I am not sure how to test/fix
This commit is contained in:
12
person.py
12
person.py
@@ -117,8 +117,7 @@ def new_person():
|
||||
st.SetMessage( "Created new Person ({})".format(person.tag) )
|
||||
return redirect( f'/person/{person.id}' )
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert( "danger" )
|
||||
st.SetMessage( "<b>Failed to add Person:</b> {}".format(e.orig) )
|
||||
st.SetMessage( f"<b>Failed to add Person:</b> {e.orig}", "danger" )
|
||||
return render_template("person.html", person=person, form=form, page_title = page_title)
|
||||
|
||||
################################################################################
|
||||
@@ -161,8 +160,7 @@ def person(id):
|
||||
db.session.commit()
|
||||
return redirect( f'/person/{person.id}' )
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert( "danger" )
|
||||
st.SetMessage( "<b>Failed to modify Person:</b> {}".format(e) )
|
||||
st.SetMessage( f"<b>Failed to modify Person:</b> {e}", "danger" )
|
||||
return render_template("person.html", form=form, page_title=page_title)
|
||||
else:
|
||||
person = Person.query.get(id)
|
||||
@@ -205,9 +203,7 @@ def add_refimg():
|
||||
db.session.commit()
|
||||
st.SetMessage( f"Associated new Refimg ({refimg.fname}) with person: {person.tag}" )
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert( "danger" )
|
||||
st.SetMessage( f"<b>Failed to add Refimg:</b> {e.orig}" )
|
||||
st.SetMessage( f"<b>Failed to add Refimg:</b> {e.orig}", "danger" )
|
||||
except Exception as e:
|
||||
st.SetAlert( "danger" )
|
||||
st.SetMessage( f"<b>Failed to modify Refimg:</b> {e}" )
|
||||
st.SetMessage( f"<b>Failed to modify Refimg:</b> {e}", "danger" )
|
||||
return redirect( url_for( 'person', id=person.id) )
|
||||
|
||||
Reference in New Issue
Block a user