homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author potorange
Recipients
Date 2007年02月13日.12:31:18
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
gettext chokes on empty Plural-Forms ?
#> audit2allow
Traceback (most recent call last):
 File "/usr/bin/audit2allow", line 34, in ?
 gettext.install('policycoreutils')
 File "/usr/lib/python2.4/gettext.py", line 482, in install
 t = translation(domain, localedir, fallback=True, codeset=codeset)
 File "/usr/lib/python2.4/gettexTraceback (most recent call last):
 File "/usr/bin/audit2allow", line 34, in ?
 gettext.install('policycoreutils')
 File "/usr/lib/python2.4/gettext.py", line 482, in install
 t = translation(domain, localedir, fallback=True, codeset=codeset)
 File "/usr/lib/python2.4/gettext.py", line 467, in translation
 t = _translations.setdefault(key, class_(open(mofile, 'rb')))
 File "/usr/lib/python2.4/gettext.py", line 177, in __init__
 self._parse(fp)
 File "/usr/lib/python2.4/gettext.py", line 302, in _parse
 print v[1]
IndexError: list index out of range
t.py", line 467, in translation
 t = _translations.setdefault(key, class_(open(mofile, 'rb')))
 File "/usr/lib/python2.4/gettext.py", line 177, in __init__
 self._parse(fp)
 File "/usr/lib/python2.4/gettext.py", line 302, in _parse
 print v[1]
IndexError: list index out of range
#> msgunfmt /usr/share/locale/fr/LC_MESSAGES/policycoreutils.mo | grep -i plural
"Plural-Forms: \n"
Bellow is a patch that fixes this for me.
--- /usr/lib/python2.4/gettext.py.orig 2007年02月13日 13:25:54.000000000 +0100
+++ /usr/lib/python2.4/gettext.py 2007年02月13日 12:36:29.000000000 +0100
@@ -298,8 +298,9 @@
 self._charset = v.split('charset=')[1]
 elif k == 'plural-forms':
 v = v.split(';')
- plural = v[1].split('plural=')[1]
- self.plural = c2py(plural)
+ if len(v) > 1:
+ plural = v[1].split('plural=')[1]
+ self.plural = c2py(plural)
 # Note: we unconditionally convert both msgids and msgstrs to
 # Unicode using the character encoding specified in the charset
 # parameter of the Content-Type header. The gettext documentation
History
Date User Action Args
2007年08月23日 14:38:27adminlinkissue1448060 messages
2007年08月23日 14:38:27admincreate

AltStyle によって変換されたページ (->オリジナル) /