Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing end periods for error messages everywhere #620

Merged
merged 6 commits into from
Jun 15, 2020
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 src/wtforms/csrf/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def validate_csrf_token(self, form, field):
:param field: The CSRF token field.
"""
if field.current_token != field.data:
raise ValidationError(field.gettext("Invalid CSRF Token"))
raise ValidationError(field.gettext("Invalid CSRF Token."))
6 changes: 3 additions & 3 deletions src/wtforms/csrf/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ def generate_csrf_token(self, csrf_token_field):
def validate_csrf_token(self, form, field):
meta = self.form_meta
if not field.data or "##" not in field.data:
raise ValidationError(field.gettext("CSRF token missing"))
raise ValidationError(field.gettext("CSRF token missing."))

expires, hmac_csrf = field.data.split("##", 1)

check_val = (self.session["csrf"] + expires).encode("utf8")

hmac_compare = hmac.new(meta.csrf_secret, check_val, digestmod=sha1)
if hmac_compare.hexdigest() != hmac_csrf:
raise ValidationError(field.gettext("CSRF failed"))
raise ValidationError(field.gettext("CSRF failed."))

if self.time_limit:
now_formatted = self.now().strftime(self.TIME_FORMAT)
if now_formatted > expires:
raise ValidationError(field.gettext("CSRF token expired"))
raise ValidationError(field.gettext("CSRF token expired."))

def now(self):
"""
Expand Down
26 changes: 14 additions & 12 deletions src/wtforms/fields/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,18 +557,18 @@ def process_formdata(self, valuelist):
try:
self.data = self.coerce(valuelist[0])
except ValueError:
raise ValueError(self.gettext("Invalid Choice: could not coerce"))
raise ValueError(self.gettext("Invalid Choice: could not coerce."))

def pre_validate(self, form):
if self.choices is None:
raise TypeError(self.gettext("Choices cannot be None"))
raise TypeError(self.gettext("Choices cannot be None."))

if self.validate_choice:
for _, _, match in self.iter_choices():
if match:
break
else:
raise ValidationError(self.gettext("Not a valid choice"))
raise ValidationError(self.gettext("Not a valid choice."))


class SelectMultipleField(SelectField):
Expand Down Expand Up @@ -604,7 +604,7 @@ def process_formdata(self, valuelist):
except ValueError:
raise ValueError(
self.gettext(
"Invalid choice(s): one or more data inputs could not be coerced"
"Invalid choice(s): one or more data inputs could not be coerced."
)
)

Expand All @@ -614,7 +614,9 @@ def pre_validate(self, form):
for d in self.data:
if d not in values:
raise ValidationError(
self.gettext("'%(value)s' is not a valid choice for this field")
self.gettext(
"'%(value)s' is not a valid choice for this field."
)
% dict(value=d)
)

Expand Down Expand Up @@ -709,7 +711,7 @@ def process_data(self, value):
self.data = int(value)
except (ValueError, TypeError):
self.data = None
raise ValueError(self.gettext("Not a valid integer value"))
raise ValueError(self.gettext("Not a valid integer value."))
else:
self.data = None

Expand All @@ -719,7 +721,7 @@ def process_formdata(self, valuelist):
self.data = int(valuelist[0])
except ValueError:
self.data = None
raise ValueError(self.gettext("Not a valid integer value"))
raise ValueError(self.gettext("Not a valid integer value."))


class DecimalField(LocaleAwareNumberField):
Expand Down Expand Up @@ -790,7 +792,7 @@ def process_formdata(self, valuelist):
self.data = decimal.Decimal(valuelist[0])
except (decimal.InvalidOperation, ValueError):
self.data = None
raise ValueError(self.gettext("Not a valid decimal value"))
raise ValueError(self.gettext("Not a valid decimal value."))


class FloatField(Field):
Expand Down Expand Up @@ -818,7 +820,7 @@ def process_formdata(self, valuelist):
self.data = float(valuelist[0])
except ValueError:
self.data = None
raise ValueError(self.gettext("Not a valid float value"))
raise ValueError(self.gettext("Not a valid float value."))


class BooleanField(Field):
Expand Down Expand Up @@ -883,7 +885,7 @@ def process_formdata(self, valuelist):
self.data = datetime.datetime.strptime(date_str, self.format)
except ValueError:
self.data = None
raise ValueError(self.gettext("Not a valid datetime value"))
raise ValueError(self.gettext("Not a valid datetime value."))


class DateField(DateTimeField):
Expand All @@ -903,7 +905,7 @@ def process_formdata(self, valuelist):
self.data = datetime.datetime.strptime(date_str, self.format).date()
except ValueError:
self.data = None
raise ValueError(self.gettext("Not a valid date value"))
raise ValueError(self.gettext("Not a valid date value."))


class TimeField(DateTimeField):
Expand All @@ -923,7 +925,7 @@ def process_formdata(self, valuelist):
self.data = datetime.datetime.strptime(time_str, self.format).time()
except ValueError:
self.data = None
raise ValueError(self.gettext("Not a valid time value"))
raise ValueError(self.gettext("Not a valid time value."))


class MonthField(DateField):
Expand Down
30 changes: 15 additions & 15 deletions src/wtforms/locale/ar/LC_MESSAGES/wtforms.po
Original file line number Diff line number Diff line change
Expand Up @@ -121,62 +121,62 @@ msgid "Invalid value, can't be any of: %(values)s."
msgstr "قيمة غير صالحة، يجب أن تكون اي من: %(values)s."

#: src/wtforms/csrf/core.py:96
msgid "Invalid CSRF Token"
msgid "Invalid CSRF Token."
msgstr "رمز CSRF غير صالح."

#: src/wtforms/csrf/session.py:63
msgid "CSRF token missing"
msgid "CSRF token missing."
msgstr "رمز CSRF مفقود."

#: src/wtforms/csrf/session.py:71
msgid "CSRF failed"
msgid "CSRF failed."
msgstr "CSRF قد فشل."

#: src/wtforms/csrf/session.py:76
msgid "CSRF token expired"
msgid "CSRF token expired."
msgstr "انتهت صلاحية رمز CSRF."

#: src/wtforms/fields/core.py:534
msgid "Invalid Choice: could not coerce"
msgid "Invalid Choice: could not coerce."
msgstr "اختيار غير صالح: لا يمكن الاجبار."

#: src/wtforms/fields/core.py:538
msgid "Choices cannot be None"
msgid "Choices cannot be None."
msgstr ""

#: src/wtforms/fields/core.py:545
msgid "Not a valid choice"
msgid "Not a valid choice."
msgstr "اختيار غير صحيح."

#: src/wtforms/fields/core.py:573
msgid "Invalid choice(s): one or more data inputs could not be coerced"
msgid "Invalid choice(s): one or more data inputs could not be coerced."
msgstr "اختيارات غير صالحة: واحدة او اكثر من الادخالات لا يمكن اجبارها."

#: src/wtforms/fields/core.py:584
#, python-format
msgid "'%(value)s' is not a valid choice for this field"
msgid "'%(value)s' is not a valid choice for this field."
msgstr "القيمة '%(value)s' ليست باختيار صحيح لهذا الحقل."

#: src/wtforms/fields/core.py:679 src/wtforms/fields/core.py:689
msgid "Not a valid integer value"
msgid "Not a valid integer value."
msgstr "قيمة العدد الحقيقي غير صالحة."

#: src/wtforms/fields/core.py:760
msgid "Not a valid decimal value"
msgid "Not a valid decimal value."
msgstr "القيمة العشرية غير صالحة."

#: src/wtforms/fields/core.py:788
msgid "Not a valid float value"
msgid "Not a valid float value."
msgstr "القيمة العائمة غير صالحة."

#: src/wtforms/fields/core.py:853
msgid "Not a valid datetime value"
msgid "Not a valid datetime value."
msgstr "قيمة الوقت والتاريخ غير صالحة."

#: src/wtforms/fields/core.py:871
msgid "Not a valid date value"
msgid "Not a valid date value."
msgstr "قيمة التاريخ غير صالحة."

#: src/wtforms/fields/core.py:889
msgid "Not a valid time value"
msgid "Not a valid time value."
msgstr ""
30 changes: 15 additions & 15 deletions src/wtforms/locale/bg/LC_MESSAGES/wtforms.po
Original file line number Diff line number Diff line change
Expand Up @@ -108,64 +108,64 @@ msgid "Invalid value, can't be any of: %(values)s."
msgstr "Невалидна стойност, не може да бъде една от: %(values)s."

#: src/wtforms/csrf/core.py:96
msgid "Invalid CSRF Token"
msgid "Invalid CSRF Token."
msgstr "Невалиден CSRF Token"

#: src/wtforms/csrf/session.py:63
msgid "CSRF token missing"
msgid "CSRF token missing."
msgstr "CSRF token липсва"

#: src/wtforms/csrf/session.py:71
msgid "CSRF failed"
msgid "CSRF failed."
msgstr "CSRF провален"

#: src/wtforms/csrf/session.py:76
msgid "CSRF token expired"
msgid "CSRF token expired."
msgstr "CSRF token изтече"

#: src/wtforms/fields/core.py:534
msgid "Invalid Choice: could not coerce"
msgid "Invalid Choice: could not coerce."
msgstr "Невалиден избор: не може да бъде преобразувана"

#: src/wtforms/fields/core.py:538
msgid "Choices cannot be None"
msgid "Choices cannot be None."
msgstr ""

#: src/wtforms/fields/core.py:545
msgid "Not a valid choice"
msgid "Not a valid choice."
msgstr "Не е валиден избор"

#: src/wtforms/fields/core.py:573
msgid "Invalid choice(s): one or more data inputs could not be coerced"
msgid "Invalid choice(s): one or more data inputs could not be coerced."
msgstr ""
"Невалиден(и) избор(и): една или повече въведени данни не могат да бъдат "
"преобразувани"

#: src/wtforms/fields/core.py:584
#, python-format
msgid "'%(value)s' is not a valid choice for this field"
msgid "'%(value)s' is not a valid choice for this field."
msgstr "'%(value)s' не е валиден избор за това поле"

#: src/wtforms/fields/core.py:679 src/wtforms/fields/core.py:689
msgid "Not a valid integer value"
msgid "Not a valid integer value."
msgstr "Не е валидна цифрова стойност"

#: src/wtforms/fields/core.py:760
msgid "Not a valid decimal value"
msgid "Not a valid decimal value."
msgstr "Не е валидна десетична стойност"

#: src/wtforms/fields/core.py:788
msgid "Not a valid float value"
msgid "Not a valid float value."
msgstr "Не е валидна стойност с плаваща запетая"

#: src/wtforms/fields/core.py:853
msgid "Not a valid datetime value"
msgid "Not a valid datetime value."
msgstr "Не е валидна стойност за дата и време"

#: src/wtforms/fields/core.py:871
msgid "Not a valid date value"
msgid "Not a valid date value."
msgstr "Не е валидна стойност за дата"

#: src/wtforms/fields/core.py:889
msgid "Not a valid time value"
msgid "Not a valid time value."
msgstr ""
30 changes: 15 additions & 15 deletions src/wtforms/locale/ca/LC_MESSAGES/wtforms.po
Original file line number Diff line number Diff line change
Expand Up @@ -108,62 +108,62 @@ msgid "Invalid value, can't be any of: %(values)s."
msgstr "Valor no vàlid, no pot ser cap d'aquests: %(values)s."

#: src/wtforms/csrf/core.py:96
msgid "Invalid CSRF Token"
msgid "Invalid CSRF Token."
msgstr "Token CSRF no vàlid"

#: src/wtforms/csrf/session.py:63
msgid "CSRF token missing"
msgid "CSRF token missing."
msgstr "Falta el token CSRF"

#: src/wtforms/csrf/session.py:71
msgid "CSRF failed"
msgid "CSRF failed."
msgstr "Ha fallat la comprovació de CSRF"

#: src/wtforms/csrf/session.py:76
msgid "CSRF token expired"
msgid "CSRF token expired."
msgstr "Token CSRF caducat"

#: src/wtforms/fields/core.py:534
msgid "Invalid Choice: could not coerce"
msgid "Invalid Choice: could not coerce."
msgstr "Opció no vàlida"

#: src/wtforms/fields/core.py:538
msgid "Choices cannot be None"
msgid "Choices cannot be None."
msgstr ""

#: src/wtforms/fields/core.py:545
msgid "Not a valid choice"
msgid "Not a valid choice."
msgstr "Opció no acceptada"

#: src/wtforms/fields/core.py:573
msgid "Invalid choice(s): one or more data inputs could not be coerced"
msgid "Invalid choice(s): one or more data inputs could not be coerced."
msgstr "Opció o opcions no vàlides: alguna de les entrades no s'ha pogut processar"

#: src/wtforms/fields/core.py:584
#, python-format
msgid "'%(value)s' is not a valid choice for this field"
msgid "'%(value)s' is not a valid choice for this field."
msgstr "'%(value)s' no és una opció acceptada per a aquest camp"

#: src/wtforms/fields/core.py:679 src/wtforms/fields/core.py:689
msgid "Not a valid integer value"
msgid "Not a valid integer value."
msgstr "Valor enter no vàlid"

#: src/wtforms/fields/core.py:760
msgid "Not a valid decimal value"
msgid "Not a valid decimal value."
msgstr "Valor decimal no vàlid"

#: src/wtforms/fields/core.py:788
msgid "Not a valid float value"
msgid "Not a valid float value."
msgstr "Valor en coma flotant no vàlid"

#: src/wtforms/fields/core.py:853
msgid "Not a valid datetime value"
msgid "Not a valid datetime value."
msgstr "Valor de data i hora no vàlid"

#: src/wtforms/fields/core.py:871
msgid "Not a valid date value"
msgid "Not a valid date value."
msgstr "Valor de data no vàlid"

#: src/wtforms/fields/core.py:889
msgid "Not a valid time value"
msgid "Not a valid time value."
msgstr ""
Loading