[Django] #22284: ValueError: plural forms expression could be dangerous

195 views
Skip to first unread message

Django

unread,
Mar 18, 2014, 3:37:01 PM3/18/14
to django-...@googlegroups.com
#22284: ValueError: plural forms expression could be dangerous
-------------------------------+--------------------
Reporter: Haikson | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22284>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 18, 2014, 3:49:10 PM3/18/14
to django-...@googlegroups.com
#22284: ValueError: plural forms expression could be dangerous
-------------------------------+--------------------------------------
Reporter: Haikson | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by bmispelon):

* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/22284#comment:1>

Django

unread,
Mar 18, 2014, 4:01:07 PM3/18/14
to django-...@googlegroups.com
#22284: ValueError: plural forms expression could be dangerous
-------------------------------+--------------------------------------
Reporter: Haikson | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Haikson):

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"
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22284#comment:2>

Django

unread,
Mar 18, 2014, 4:02:18 PM3/18/14
to django-...@googlegroups.com
#22284: ValueError: plural forms expression could be dangerous
-------------------------------+--------------------------------------
Reporter: Haikson | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by anonymous):

* resolution: invalid => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/22284#comment:3>

Django

unread,
Mar 18, 2014, 4:30:07 PM3/18/14
to django-...@googlegroups.com
#22284: ValueError: plural forms expression could be dangerous
-------------------------------+--------------------------------------
Reporter: Haikson | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by anonymous):

* resolution: fixed => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/22284#comment:4>

Reply all
Reply to author
Forward
0 new messages