Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ihatemoney/api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flask import current_app, request
from flask_restful import Resource, abort
from werkzeug.security import check_password_hash
from wtforms.fields.core import BooleanField
from wtforms.fields import BooleanField

from ihatemoney.forms import EditProjectForm, MemberForm, ProjectForm, get_billform_for
from ihatemoney.models import Bill, Person, Project, db
Expand Down
21 changes: 18 additions & 3 deletions ihatemoney/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,23 @@
from flask_wtf.form import FlaskForm
from markupsafe import Markup
from werkzeug.security import check_password_hash, generate_password_hash
from wtforms.fields.core import Label, SelectField, SelectMultipleField
from wtforms.fields.html5 import DateField, DecimalField, URLField
from wtforms.fields.simple import BooleanField, PasswordField, StringField, SubmitField
from wtforms.fields import (
BooleanField,
DateField,
DecimalField,
Label,
PasswordField,
SelectField,
SelectMultipleField,
StringField,
SubmitField,
)

try:
# Compat for WTForms <= 2.3.3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why should we keep backwards compatibility?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's exactly my question. My experience showed me that jumping early on the "new backward incompatible release" train can be really annoying. So I tend to prefer solutions that introduce a backward compatibility layer, but I think this is not possible here, due to the default change for string values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My experience showed me that jumping early on the "new backward incompatible release" train can be really annoying.

Ah, that seems bad indeed. Could you explain why?

from wtforms.fields.html5 import URLField
except ModuleNotFoundError:
from wtforms.fields import URLField
from wtforms.validators import (
URL,
DataRequired,
Expand Down Expand Up @@ -312,6 +326,7 @@ class BillForm(FlaskForm):
original_currency = SelectField(_("Currency"), validators=[DataRequired()])
external_link = URLField(
_("External link"),
default="",
Comment thread
Glandos marked this conversation as resolved.
validators=[Optional(), URL()],
description=_("A link to an external document, related to this bill"),
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install_requires =
Flask-SQLAlchemy>=2.4,<3
Flask-Talisman>=0.8,<1
Flask-WTF>=0.14.3,<2
WTForms>=2.3.1,<2.4
WTForms>=2.3.1,<3.1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be >=3.0 ?

Flask>=2,<3
itsdangerous>=2,<3
Jinja2>=3,<4
Expand Down