Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#22284 closed Uncategorized (invalid)

ValueError: plural forms expression could be dangerous

Reported by: Kamo Petrosyan Owned by: nobody
Component: Uncategorized Version: 1.6
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


On python collectstatic raises

Traceback (most recent call last):
  File "", line 10, in <module>
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/core/management/", line 399, in execute_from_command_line
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/core/management/", line 392, in execute
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/core/management/", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/core/management/", line 280, in execute
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 130, in activate
    return _trans.activate(language)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 188, in activate
    _active.value = translation(language)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 177, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 163, in _fetch
    res = _merge(apppath)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 150, in _merge
    t = _translation(path)
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 132, in _translation
    t = gettext_module.translation('django', path, [loc], DjangoTranslation)
  File "/usr/lib64/python2.7/", line 478, in translation
    t = _translations.setdefault(key, class_(fp))
  File "/home/kamo/.virtualenvs/django/lib/python2.7/site-packages/django/utils/translation/", line 81, in __init__
    gettext_module.GNUTranslations.__init__(self, *args, **kw)
  File "/usr/lib64/python2.7/", line 180, in __init__
  File "/usr/lib64/python2.7/", line 315, in _parse
    self.plural = c2py(plural)
  File "/usr/lib64/python2.7/", line 93, in c2py
    raise ValueError, 'plural forms expression could be dangerous'
ValueError: plural forms expression could be dangerous

Change History (4)

comment:1 Changed 5 years ago by Baptiste Mispelon

Resolution: invalid
Status: newclosed


According to this post:, this means that there is an error in one of your translation files, not in Django.

You need to remove (or better yet, fix) the line that reads "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n".


comment:2 Changed 5 years ago by Kamo Petrosyan

Thanks! There was an error in application django-dbtemplates

I've removed lines

#"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
#"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

comment:3 Changed 5 years ago by anonymous

Resolution: invalidfixed

comment:4 Changed 5 years ago by anonymous

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