Skip to content

[WTForms] render_kw, get_translations() and some messages can be None #16828

Open

Description

@hemtilva

In WTForms 3.3.2 these are None by default, but the stubs don't allow it:

  • Field.render_kw
  • DefaultMeta.get_translations() returns None when locales is False (the default)
  • validators.DateRange.message
  • SelectField.invalid_choice_message

So form.name.render_kw["class"] = "x" or form.meta.get_translations(form).gettext(...) pass mypy and raise at runtime. DefaultMeta.translations_cache is keyed by a tuple of locales or None, not str. DateTimeLocalField.tz is also missing as an attribute.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions