You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.
This issue occurs when validators have been added to a Flask-Admin field via the form_args attribute. It appeares when using the NumberRange validator but others might be concerned as well. A false validation of the NumberRange validator will result in a KeyError. This is due to the message string getting passed to gettext with formatting keys but without values.
2017-01-16 21:16:10,570] ERROR in app: Exception on /fabric/edit/ [POST]
Traceback (most recent call last):
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/model/base.py", line 1973, in edit_view
if self.validate_form(form):
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/model/base.py", line 1290, in validate_form
return validate_form_on_submit(form)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/helpers.py", line 65, in validate_form_on_submit
return is_form_submitted() and form.validate()
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/form.py", line 310, in validate
return super(Form, self).validate(extra)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/form.py", line 152, in validate
if not field.validate(self, extra):
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 204, in validate
stop_validation = self._run_validation_chain(form, chain)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 224, in _run_validation_chain
validator(form, self)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/validators.py", line 139, in __call__
message = field.gettext('Number must be at least %(min)s.')
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 164, in gettext
return self._translations.gettext(string)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_admin/babel.py", line 55, in gettext
return wtforms_domain.gettext(string)
File "/Users/stefan/Documents/python/projects/inventory/venv/lib/python3.6/site-packages/flask_babelex/__init__.py", line 534, in gettext
return t.ugettext(string) % variables
KeyError: 'min'
The text was updated successfully, but these errors were encountered:
This issue occurs when validators have been added to a Flask-Admin field via the
form_args
attribute. It appeares when using theNumberRange
validator but others might be concerned as well. A false validation of theNumberRange
validator will result in aKeyError
. This is due to the message string getting passed togettext
with formatting keys but without values.The text was updated successfully, but these errors were encountered: