Opened 4 years ago

Closed 4 years ago

#31868 closed Bug (duplicate)

Plural forms expression could be dangerous — at Version 1

Reported by: Paul Owned by: nobody
Component: Internationalization Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

Somewhere around the end of July 2020, this error started occurring with my website. The code has not been changed for ages, except for several translations added in the .po file.
The Latin .po file was added two years ago. Everything had been working fine until last week, when 500 errors started bumping for any Latin po file usage (i.e. translation.activate('la')).
I’ve tried:

  1. Reverting to the early-July version of the .po files;
  2. Removing the ‘Plural Forms’ line from the .po files;
  3. Removing the .po files at all.

This does not help at all. The only thing which eliminates the issue is setting i18N = False in settings.py.

Here is the complete traceback:

Traceback:  
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/core/decorators.py" in _view
  92.                     response = view_func(request, *args, **kwargs)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/translation/views.py" in get
  597.                                        for_extension=request.is_ajax())
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/translation/manager.py" in find_translations
  186.             if can_sort_translations or (not trans in related and not trans.from_word_form.for_link_str in related_links):
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/functional.py" in __get__
  35.         res = instance.__dict__[self.name] = self.func(instance)
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/word/models/base.py" in for_link_str
  836.         return strip_tags(unicode(self))
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/word/mixins.py" in __str__
  177.         return parse_markdown(main_field_value, self.lang())
 
File "/home/robbit/webapps/django_tran_bot/tran_bot/core/utils/html.py" in parse_markdown
  167.     with translation.override('uk' if to_lang else from_lang):
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/__init__.py" in __enter__
  181.             activate(self.language)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/__init__.py" in activate
  166.     return _trans.activate(language)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/trans_real.py" in activate
  239.     _active.value = translation(language)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/trans_real.py" in translation
  228.         _translations[language] = DjangoTranslation(language)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/trans_real.py" in __init__
  129.             self._add_installed_apps_translations()
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/trans_real.py" in _add_installed_apps_translations
  177.                 translation = self._new_gnu_trans(localedir)
 
File "/home/robbit/webapps/django_tran_bot/lib/python2.7/Django-1.11.29-py2.7.egg/django/utils/translation/trans_real.py" in _new_gnu_trans
  156.             fallback=use_null_fallback)
 
File "/usr/lib64/python2.7/gettext.py" in translation
  480.                 t = _translations.setdefault(key, class_(fp))
 
File "/usr/lib64/python2.7/gettext.py" in __init__
  180.             self._parse(fp)
 
File "/usr/lib64/python2.7/gettext.py" in _parse
  317.                         self.plural = c2py(plural)
 
File "/usr/lib64/python2.7/gettext.py" in c2py
  93.             raise ValueError, 'plural forms expression could be dangerous'

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Description: modified (diff)
Resolution: duplicate
Status: newclosed

Duplicate of #22284. Moreover Python 2.7 and Django 1.11 are no longer supported.

Note: See TracTickets for help on using tickets.
Back to Top