Skip to content

Flask Mongoengine WTForms update#812

Merged
noirbizarre merged 12 commits intoopendatateam:devfrom
noirbizarre:flask-mongoengine-wtf-update
Mar 3, 2017
Merged

Flask Mongoengine WTForms update#812
noirbizarre merged 12 commits intoopendatateam:devfrom
noirbizarre:flask-mongoengine-wtf-update

Conversation

@noirbizarre
Copy link
Contributor

This PR supersedes #586, #654, #682 and #767 because they were dependent upgrades.
These PR have been merged into this one and all required fixes/refactorings applied:

  • flask_wtf.Form is now flask_wtf.FlaskForm and has a little signature change
  • flask_mongoengine has a new connection manager
  • wtform-json use StringField instead of the deprecated TextField which breaks every StringField instance (inherited or not) using default value (pending bug fix: Fixes (Python 3.6, tox, StringField default, latest versions...) kvesteri/wtforms-json#49), casting value to something else than a string or expected None as default

Consequence:

  • make use of mongoengine.get_db instead of the removed flask_mongoengine.connection.get_db
  • cleanup the form fields dependency tree: all fields expecting None as default/empty, inheriting from StringField but returning another type or using a default value now use udata.forms.field.Field as base class
  • Form(formdata, obj) calls are now Form(formdata, obj=obj)

Copy link
Member

@davidbgk davidbgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


from flask_mongoengine.wtf.models import ModelForm as MEModelForm # noqa
from flask_wtf import Form as WTForm # noqa
from flask_wtf import FlaskForm # noqa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#noqa still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was happy too to remove it but sadly this is here because of the mandatory early wtforms_json.init()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining print statement.

@noirbizarre noirbizarre merged commit 4dcd59f into opendatateam:dev Mar 3, 2017
@noirbizarre noirbizarre deleted the flask-mongoengine-wtf-update branch March 3, 2017 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments