Opened 11 years ago

Closed 11 years ago

Last modified 11 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

Description

On python manage.py collectstatic raises

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

Change History (4)

comment:1 by Baptiste Mispelon, 11 years ago

Resolution: invalid
Status: newclosed

Hi,

According to this post: http://stackoverflow.com/questions/4935704/django-gettext-raises-valueerror-plural-forms-expression-could-be-dangerous, 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".

Thanks.

comment:2 by Kamo Petrosyan, 11 years ago

Thanks! There was an error in application django-dbtemplates
https://github.com/jezdez/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 by anonymous, 11 years ago

Resolution: invalidfixed

comment:4 by anonymous, 11 years ago

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