Package: python3-wtforms
Version: 2.2.1-1
Severity: normal
X-Debbugs-Cc: j...@nahmias.net

Hello,

It seems that the wtforms.mo compiled gettext message catalogs are no
longer being generated and distributed in the python3-wtforms package.
They do exist in 2.1-1 (stretch). This causes an issue if a python
program which uses wtforms tries to respect the declared locale. For
example, I see the following error in the wtforms-alchemy testsuite:

________________ TestModelFormFactory.test_class_meta_wtforms2 _________________

self = <tests.test_model_form_factory.TestModelFormFactory object at 
0x7f2dd03e6680>

    def test_class_meta_wtforms2(self):
        if LooseVersion(wtforms.__version__) < LooseVersion('2'):
            return  # skip test for wtforms < 2
    
        self.init()
    
        class SomeForm(Form):
            class Meta:
                locales = ['fr']
                foo = 9
    
        class OtherForm(SomeForm):
            class Meta:
                pass
    
        class TestCustomBase(model_form_factory(SomeForm)):
            class Meta:
                model = self.ModelTest
    
>       form = TestCustomBase()

tests/test_model_form_factory.py:112: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/wtforms/form.py:212: in __call__
    return type.__call__(cls, *args, **kwargs)
wtforms_alchemy/__init__.py:290: in __init__
    super(ModelForm, self).__init__(*args, **kwargs)
/usr/lib/python3/dist-packages/wtforms/form.py:272: in __init__
    super(Form, self).__init__(self._unbound_fields, meta=meta_obj, 
prefix=prefix)
/usr/lib/python3/dist-packages/wtforms/form.py:44: in __init__
    translations = self._get_translations()
/usr/lib/python3/dist-packages/wtforms/form.py:85: in _get_translations
    return self.meta.get_translations(self)
/usr/lib/python3/dist-packages/wtforms/meta.py:108: in get_translations
    translations = self.translations_cache[locales] = 
i18n.get_translations(locales)
/usr/lib/python3/dist-packages/wtforms/i18n.py:37: in get_translations
    translations = getter(languages)
/usr/lib/python3/dist-packages/wtforms/i18n.py:25: in 
get_builtin_gnu_translations
    return gettext.translation('wtforms', messages_path(), languages)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

domain = 'wtforms', localedir = '/usr/lib/python3/dist-packages/wtforms/locale'
languages = ('fr',), class_ = <class 'gettext.GNUTranslations'>
fallback = False, codeset = ['unspecified']

    def translation(domain, localedir=None, languages=None,
                    class_=None, fallback=False, codeset=_unspecified):
        if class_ is None:
            class_ = GNUTranslations
        mofiles = find(domain, localedir, languages, all=True)
        if not mofiles:
            if fallback:
                return NullTranslations()
            from errno import ENOENT
>           raise FileNotFoundError(ENOENT,
                                    'No translation file found for domain', 
domain)
E           FileNotFoundError: [Errno 2] No translation file found for domain: 
'wtforms'

/usr/lib/python3.10/gettext.py:607: FileNotFoundError


Please add this back into the package.
Thanks,
--Joe

Reply via email to